P. 1
Cursors

Cursors

|Views: 3|Likes:
Published by Anil Prasad Allu

More info:

Published by: Anil Prasad Allu on Oct 22, 2011
Copyright:Attribution Non-commercial

Availability:

Read on Scribd mobile: iPhone, iPad and Android.
download as DOCX, PDF, TXT or read online from Scribd
See more
See less

04/28/2012

pdf

text

original

What is the ref cursor in Oracle?

REF_CURSOR allows returning a recordset/cursor from a Stored procedure. It is of 2 types: Strong REF_CURSOR: Returning columns with datatype and length need to be known at compile time. Weak REF_CURSOR: Structured does not need to be known at compile time. Syntax till Oracle 9i create or replace package REFCURSOR_PKG as TYPE WEAK8i_REF_CURSOR IS REF CURSOR; TYPE STRONG REF_CURSOR IS REF CURSOR RETURN EMP%ROWTYPE; end REFCURSOR_PKG; Procedure returning the REF_CURSOR: create or replace procedure test( p_deptno IN number , p_cursor OUT REFCURSOR_PKG.WEAK8i_REF_CURSOR) is begin open p_cursor FOR select * from emp where deptno = p_deptno; end test; Since Oracle 9i we can use SYS_REFCURSOR create or replace procedure test( p_deptno IN number,p_cursor OUT SYS_REFCURSOR) is begin open p_cursor FOR select * from emp where deptno = p_deptno; end test; For Strong create or replace procedure test( p_deptno IN number,p_cursor OUT REFCURSOR_PKG.STRONG REF_CURSOR) is begin open p_cursor FOR select * from emp where deptno = p_deptno; end test; Oracle - What is the ref cursor in Oracle? - April 10, 2009 at 11:00 AM

What is the ref cursor in Oracle?
Cursor is a reference type in oracle. We can allocate different storage locations to the cursor when the program runs. Syntax Type <type_name> is REF CURSOR RETURN <return type> Return_type – Name of new reference type. Return Type – This represents select list type that will be returned by the query. Also read

use of parameterized cursor A parameter makes the cursor more reusable... Cursor variables can be used to hold different values at run time..... . Oracle .............. Define Simple/Explicit ... It is used to hold address of an item rather than the item itself.. What WHERE CURRENT OF clause does in a cursor?..........Oracle cursors interview questions What a SELECT FOR UPDATE cursor represent?. Parametric and Internal/Implicit cursor.. What is the difference between REF Cursor & Normal Cursor in oracle? Normal cursors fall under the category of static cursors while REF cursors are dynamic....... Can you pass a parameter to a cursor?.. Explain the functioning of CURSOR FOR LOOP with example... A parameter avoids scoping problems. What is use of a cursor variable in oracle? A cursor variable works like pointer in C......

7.250 0130$250.:784783907.7.$% #&!%.3901:3.88.5...:7847705708039 .34:5.. .:80/4083.9.943341&#$ # # !90.9#&##% .:7847 5.2090794.:7847 .06:089438 .0.

7.5.3/39073.9 !.2097...

.25.3-0:80/944/ /1107039.9.:08..-0 5.7.-0347.209072.7.9890/110703..4/88.20907.39027.//708841.0-09003#:7847 472.:7847.0890.209070/..3909029801 :7847.0 .7.97:3920  7.:78478.:3/0790..:7847 5..:784781.0 472.:7847..98:8041..:7847247070:8.0 :80415.9 ..90474189..-08.:784780#.  .2.7..-047805439073 98:80/944/.7..:7847  .:7847347.70/3.453574-028   .7..9079.

You're Reading a Free Preview

Download
scribd
/*********** DO NOT ALTER ANYTHING BELOW THIS LINE ! ************/ var s_code=s.t();if(s_code)document.write(s_code)//-->