Search notes:
Oracle: DBMS_SQL.OPEN_CURSOR
dbms_sql.open_cursor
opens a cursor for an
SQL statement. The cursor is identified by an
integer
(technically a
number
) returned by the function
After opening the cursor, the text of the SQL statement to be executed needs to be associated with the cursor by calling
dbms_sql.parse
.
When the cursor is not used anymore, it should be closed with dbms_sql.close_cursor
.
declare
c integer;
begin
c := dbms_sql.open_cursor;
dbms_sql.parse(c, q'[ SQL STATEMENT GOES HERE ]', dbms_sql.native);
…
dbms_sql.close(c);
end/
/
After opening the cursor, the text of the SQL statement must be parsed using
dbms_sql.parse
.