Why can't we use strong ref cursor with dynamic SQL Statement?
Posted
by Vineet
on Stack Overflow
See other posts from Stack Overflow
or by Vineet
Published on 2010-05-06T18:27:50Z
Indexed on
2010/05/06
19:28 UTC
Read the original article
Hit count: 170
Hi ALL, I am trying to use a strong ref cur with dynamic sql statment but it is giving out an error,but when i use weak cursor it works,Please explain what is the reason and please forward me any link of oracle server architect containing matter about how compilation and parsing is done in Oracle server. THIS is the error along with code.
ERROR at line 6:
ORA-06550: line 6, column 7:
PLS-00455: cursor 'EMP_REF_CUR' cannot be used in dynamic SQL OPEN statement
ORA-06550: line 6, column 2:
PL/SQL: Statement ignored
declare
type ref_cur_type IS REF CURSOR RETURN employees%ROWTYPE; --Creating a strong REF cursor,employees is a table
emp_ref_cur ref_cur_type;
emp_rec employees%ROWTYPE;
BEGIN
OPEN emp_ref_cur FOR 'SELECT * FROM employees';
LOOP
FETCH emp_ref_cur INTO emp_rec;
EXIT WHEN emp_ref_cur%NOTFOUND;
END lOOP;
END;
© Stack Overflow or respective owner