troubleshooting Question

Error while using weak ref cursor in oracle 12c

Avatar of sam_2012
sam_2012 asked on
Oracle Database* Oracle PL/SQL* Oracle12c
3 Comments1 Solution45 ViewsLast Modified:
Hi Team,

I have the below code in plsql for processing weak cursors , whenever i run  the code i get the below error. Any help is really appreciated. Iam using oracle 12c

ERROR at line 12:
ORA-06550: line 12, column 59:
PLS-00487: Invalid reference to variable 'L_EMPDEPTDATA'
ORA-06550: line 12, column 4:
PL/SQL: Statement ignored


declare
type t_empdeptdata is ref cursor;
l_empdeptdata t_empdeptdata ;
begin
open l_empdeptdata for
Select e.employee_id
from employees e
where e.department_id=30;
            begin
            loop
            exit when l_empdeptdata%NOTFOUND;
                  dbms_output.put_line ('Employee_id : '|| l_empdeptdata.employee_id );
            end loop;
            end;
            
      close l_empdeptdata;
end;
/
Join the community to see this answer!
Join our exclusive community to see this answer & millions of others.
Unlock 1 Answer and 3 Comments.
Join the Community
Learn from the best

Network and collaborate with thousands of CTOs, CISOs, and IT Pros rooting for you and your success.

Andrew Hancock - VMware vExpert
See if this solution works for you by signing up for a 7 day free trial.
Unlock 1 Answer and 3 Comments.
Try for 7 days

”The time we save is the biggest benefit of E-E to our team. What could take multiple guys 2 hours or more each to find is accessed in around 15 minutes on Experts Exchange.

-Mike Kapnisakis, Warner Bros