How to display the contents of a current record fetched in
a reference cursor?
Answers were Sorted based on User's Feedback
Answer / karthik
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.
declare
cursor v_cursor is
select empno empnm empdept from emp where empdept 10;
begin
open v_cursor;
loop
fetch v_cursor into c_empno c_empnm c_empdept;
exit when v_cursor notfound;
dbms_output.put_line(c_empno || ' | ' || c_empnm || ' | ' ||
c_empdept );
end loop;
close v_cursor;
end;
Is This Answer Correct ? | 0 Yes | 2 No |
What is type and rowtype in pl sql?
What packages(if any) has oracle provided for use by developers?
suppose I have two table one Emp and other is dpt. Emp table has a field ,dept id,name ,sal and dpt table has a field dept id,dept name. Now I want to find out the emplyee list whose sal is between 2000-3000 from dept x.
7 Answers Geometric Software, IBM,
What is the starting oracle error number? What is meant by forward declaration in functions?
what are the advantages of using stored procedures? : Sql dba
Determine if oracle date is on a weekend?
What is a stored procedure in sql with example?
What is difference between stored function and application function?
Explain polymorphism in pl/sql.
What are the possible values that can be stored in a boolean data field?
how to analyze tables with 'mysqlcheck'? : Sql dba
What is a trigger in pl/sql?