We are using SQLParser to check for syntax errors in Oracle SQL sentences. I saw that the library supports PL/SQL, however, we are having issues parsing the following SQL:
declare
newSeq number;
begin
select MAX(id_organization) + 1 into newSeq from c_organization;
If newSeq > 0 then
begin
execute immediate 'DROP SEQUENCE S_C_ORGANIZATION';
exception when others then
null;
end;
execute immediate 'CREATE SEQUENCE S_C_ORGANIZATION INCREMENT BY 1 START WITH ' || newSeq ;
end if;
end
Using their C# library with the following code:
TGSqlParser parser = new TGSqlParser(EDbVendor.dbvoracle);
parser.sqltext = sql;
if (parser.checkSyntax() > 0){
Console.WriteLine(parser.Errormessage);
}
We get:
end of input(10102) near: (0,0) no_root_node(-1000) near: no root node(0,0) end of input(10102) near: (0,0) no_root_node(-1000) near: no root node(0,0)
Any idea if the library supports this kind of PL/SQL statements? (maybe we are doing something wrong)