The following shows the PL / SQL block below:
SQL> declare 2 i int; 3 begin 4 i := dbms_sql.open_cursor; 5 dbms_sql.parse(i,'begin dontexist; dbms_output.put(''a''); end;',1); 6 dbms_sql.close_cursor(i); 7 end; 8 / declare * FOUT in regel 1: .ORA-06550: Regel 1, kolom 7: PLS-00201: identifier 'DONTEXIST' must be declared. ORA-06550: Regel 1, kolom 7: PL/SQL: Statement ignored. ORA-06512: in "SYS.DBMS_SQL", regel 1120 ORA-06512: in regel 5
Because I do not have a procedure called DONTEXIST. My question is why is this next PL / SQL block completed successfully?
SQL> declare 2 i int; 3 begin 4 i := dbms_sql.open_cursor; 5 dbms_sql.parse(i,'begin dontexist; dbms_output.put(:a); end;',1); 6 dbms_sql.close_cursor(i); 7 end; 8 / PL/SQL-procedure is geslaagd.
The difference is using a binding variable instead of a constant, but I would like to know why this matters.
This is Oracle 12.1.0.2
source share