what is ref cursor in pl/sql?

Answers were Sorted based on User's Feedback



what is ref cursor in pl/sql?..

Answer / hitendra yadav

Reference cursor is as like pointer in C ad PASCAL language
which is point the data's memory location,REF CURSOR is
dynamic cursor which can be open for more then one query.
there are two type of ref cursof:-
(1) WEEK REF CURSOR:- ref cursor which not have return
cluse in defination.
(2) STRONG REF CURSOR :- ref cursor which use return cluse
in defination.

for example:-

SET serveroutput ON
DECLAR
TYPE eref REF CURSOR; -- WEEK REF CURSOR
eref1 eref;
erec employees%ROWTYPE;
BEGIN
OPEN eref1 FOR SELECT *
FROM employees
WHERE dept_id=90;
LOOP
FETCH eref1
INTO erec;
DBMS_OUTPUT.PUT_LINE(erec.emp_id);
EXIT WHEN eref1%NOTFOUND;
END LOOP;
END;

Is This Answer Correct ?    30 Yes 4 No

what is ref cursor in pl/sql?..

Answer / swapna

A Reference Cursor is majorly used when we want to execute
a dynamic select statement causes to retrieve more than
one record. We can pass Reference cursor result as a out
parameter which can be used in other sub programs.

Is This Answer Correct ?    27 Yes 7 No

what is ref cursor in pl/sql?..

Answer / suresh kumar somayajula

Re-usability of a cursor is nothing but " REF CURSOR".
It is of 2 types.
1. Weak REF Cursor
2. Strong REF Cursor.

SYNTAX:
1.Strong Refcursor
SYN: TYPE <TYPE_NAME> IS
REFCURSOR RETURN <RETURN_DATA_TYPE>
2.Weak Refcursor
SYN : TYPE <TYPE_NAME> IS
REFCURSOR

Thank you,
Suresh

Is This Answer Correct ?    11 Yes 2 No

Post New Answer

More SQL PLSQL Interview Questions

what are the differences among rownum, rank and dense_rank? : Sql dba

0 Answers  


What is varchar data type in sql?

0 Answers  


What is the difference between anonymous block and named blocks?

3 Answers  


Does SQL*Plus contains pl/sql Engine?

1 Answers   TCS,


What are the benefits of pl/sql packages?

0 Answers  






What are the attributes of SQL*PLUS ?

2 Answers   Dream Careers, Oracle,


Which are the different types of indexes in sql?

0 Answers  


Can we use two order by clause in query?

0 Answers  


Differences between Oracle 9i and 10g (Probably in terms of SQL and PL/SQL)?

0 Answers   IBM,


Is keyword pl sql?

0 Answers  


How can you fetch first 5 characters of the string?

0 Answers  


how to rename an existing table in mysql? : Sql dba

0 Answers  


Categories