How to display the contents of a current record fetched in a ref cursor

Showing Answers 1 - 6 of 6 Answers

Mano

  • Jul 19th, 2006
 

Hi,

U define a variable in the SQL Prompt as ref cursor ,Before that u have to write a procedure with a sys ref cursor as a inout parameter.Then execute the procedure by passing the variable defined in the SQL prompt and print the variable, It will display the records.

Mano

  Was this answer useful?  Yes

Shiv Mangal Rahi

  • Jul 25th, 2006
 

Hi,

You could do the same as given under below for emp table.....

CREATE OR REPLACE procedure proc
as
begin
declare
v_empno emp.empno%type;
v_ename emp.ename%type;
cursor c_emp is
select empno,ename from emp;
begin
open c_emp;
loop
fetch c_emp into v_empno , v_ename;
dbms_output.put_line(v_empno||'   '|| v_ename);
exit when c_emp%notfound;
end loop;
close c_emp;
end;
end proc;
/

  Was this answer useful?  Yes

gouthami kodangal

  • Aug 13th, 2006
 

by making use of sql%rowfound.

 

  Was this answer useful?  Yes

Habib Ali

  • May 10th, 2016
 

Copy your REFCURSOR output to a RECORD datatype, and LOOP through it for each record

  Was this answer useful?  Yes

Give your answer:

If you think the above answer is not correct, Please select a reason and add your answer below.

 

Related Answered Questions

 

Related Open Questions