what is ref cursor in pl/sql?

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



Post New Answer       View All Answers


Please Help Members By Posting Answers For Below Questions

What is sqlexception in java?

546


What is the purpose of a sql?

521


How does sql developer connect to oracle database?

516


How many triggers can be applied on a table?

506


What is cross join sql?

494






What is the difference between distinct and unique in sql?

466


What does dml mean?

543


Why use subqueries instead of joins?

601


Can we use pl sql in sql server?

538


difference between anonymous blocks and sub-programs.

620


Why is pl sql used?

525


Can we call stored procedure in function?

548


What are different types of functions in sql?

511


What is a database trigger?

607


what is heap table? : Sql dba

603