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

Answer Posted / 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



Post New Answer       View All Answers


Please Help Members By Posting Answers For Below Questions

What is rank dense_rank and partition in sql?

535


how many values can the set function of mysql take? : Sql dba

530


Why is partition used in sql?

547


What is write ahead logging in sql server?

560


What operators deal with null?

605






How can you load multi line records? : aql loader

655


1) Synonyms 2) Co-related Subquery 3) Different Jobs in Plsql 4) Explain Plan 5) Wrap 6) Query Optimization Technique 7) Bulk Collect 8) Types of index 9) IF primary key is created then the index created ? 10) Foreign Key 11) Exception Handling 12) Difference Between Delete and Trunc 13) Procedure Overloading 14) Grant Revoke 15) Procedure Argument types. 16) Functions. 17) Joins

1152


How to call a javascript function from pl sql?

559


What are system versioned tables?

549


Can a foreign key be null?

586


differentiate between float and double. : Sql dba

555


which operator is used in query for pattern matching? : Sql dba

543


Can we have two clustered index on a table?

560


How many types of literals are available in pl sql?

512


What is the difference between microsoft access and sql?

496