I have a TextEdit in my GUI which takes PlSql statement, which further can be saved by user in DB. The requirement is to validate this PlSql statement before saving. In Oracle we can do this with the following code:
DECLARE
cursor_name INTEGER;
BEGIN
cursor_name := dbms_sql.open_cursor;
dbms_sql.parse(cursor_name,'select * from schema.TableName',DBMS_SQL.NATIVE);
DBMS_SQL.CLOSE_CURSOR(cursor_name);
EXCEPTION
WHEN OTHERS THEN
DBMS_SQL.CLOSE_CURSOR(cursor_name);
dbms_output.put_line('Invalid PlSql');
END;
Hence when given PlSql or SQL is not a valid statement then I get the error message 'Invalid PlSql'. Can anyone suggest how can I catch this exception in my vb.net code? I mean I can excute this query in my code but I can not make any stored procedure in DB in oder to get the exception as return value.
Is there any other way we can validate/parse PlSql statements in vb.net?