Connecting Tech Pros Worldwide Help | Site Map

Exception In Ref Cursor

  #1  
Old July 12th, 2007, 10:30 PM
Newbie
 
Join Date: Jul 2007
Posts: 15
Hi all,
How can i raise an exception in ref cursor.

CREATE OR REPLACE PACKAGE demo
is
TYPE empcurtyp IS REF CURSOR;
PROCEDURE getempdetails(job_title in varchar2, emp_refcur out empcurtyp);
END demo;


CREATE OR REPLACE PACKAGE BODY demo
IS
PROCEDURE getempdetails(job_title in varchar2,emp_refcur out empcurtyp)
IS
BEGIN
OPEN emp_refcur
FOR
SELECT *
FROM emp
WHERE job = job_title;
EXCEPTION
WHEN no_data_found
THEN
dbms_output.put_line('No Data for '|| job_title);
end getempdetails;
end;

Var a refcursor
exec demo.getempdetails('President',:a)

If there is no job_title as 'President',i need to display these message
dbms_output.put_line('No Data for '|| job_title);

Thanks
Raghu
  #2  
Old July 13th, 2007, 06:15 AM
debasisdas's Avatar
Moderator
 
Join Date: Dec 2006
Location: Bangalore ,India
Posts: 7,485
Provided Answers: 1

re: Exception In Ref Cursor


You can't use dbms_output.put_line to print a ref cursor.
Reply


Similar Threads
Thread Thread Starter Forum Replies Last Post
PL/SQL - ref cursor Tim Smith answers 0 June 27th, 2008 07:36 PM
REF Cursor returned across db link? Matthew Houseman answers 6 June 27th, 2008 06:21 PM
PL/SQL - ref cursor Tim Smith answers 0 July 19th, 2005 11:08 PM
REF Cursor returned across db link? Matthew Houseman answers 6 July 19th, 2005 10:12 PM