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

how can we write a column values horizontal by using sql stmt; ex: select name from table_name;(actual output) a b c d require output is a b c d

5 Answers   Honeywell, Interact,


What is an index and types of indexes. How many number of indexes can be used per table ?

12 Answers   Accenture, BirlaSoft, Cognizant, CTS, Symphony,


What is the primary key?

0 Answers  


If there are 1 to 100 numbers in a table and in that 100 numbers some 10 numbers are deleted.I want to find out the missing numbers between 1 to 100 by pl/sql how?

9 Answers   JPMorgan Chase,


When we give SELECT * FROM EMP; How does oracle respond?

24 Answers   Accenture, HCL, Infosys,






Can i possible to see Table Details ? Ex : Table Name Date Time User Emp May/18/2010 12:59pm Scott

3 Answers  


what are the maximum number of rows that can be constructed by inserting rows directly in value list? : Transact sql

0 Answers  


What are literals in sql server?

0 Answers  


Explain autonomous transaction.

0 Answers  


What is range partitioning?

0 Answers  


How many types of cursors supported in pl/sql?

0 Answers  


what is sql in mysql? : Sql dba

0 Answers  


Categories