WHAT IS REFCURSOR IN ORACLE ?

Answer Posted / shaik jeelan basha

By using Ref cursor we can change the select statement
dynamically at runtime which is available in the cursor
definition based on some validation.For this we need to
define ref cursor type by using following syntax.

type <type_name> is ref cursor return <return_type>;

here <type_name> is the name of the ref cursor and
<return_type> will be the return type of ref cursor it may
be %type/%rowtype/record type/plsql table type/nested table
type/varray type.

if <return_type> is mentioned we will called it as strong
ref cursor.

if <return_type> is not mentioned we will called it as weak
ref cursor.

after this we need to define ref cursor variable by using
the following syntax.

v_variable_name ref_cursor_type_name;

then based on validations we can change the ref cursor
dynamically.

for example
------------------
declare
type ref_cur is ref cursor;
v_ref_cur ref_cur;
v_deptno emp.deptno%type;
begin
select deptno into v_deptno from emp where empno=7788;
if v_deptno=20 then
open v_ref_cur for select * from emp;
elsif v_deptno=30 then
open v_ref_cur for select * from dept;
else
open v_ref_cur for select * from salgrade;
end if;
end;

Is This Answer Correct ?    11 Yes 0 No



Post New Answer       View All Answers


Please Help Members By Posting Answers For Below Questions

In oracle application how do you debug or trace errors?

643


Hi, Anybody please send me the Oracle APPS 1i technical interview questions (Real time) as wel as sample resume also?

2133


Is soa a part of oracle fusion middleware?

615


In which tables receopt application form Appliy to field Value will come. I know one table i.e, ra_customer_trx.trx_number. Could U please any one tell me other than this except(ra_customer_trx and ar_payment_schedules_all tables). plz mentioned tables_name.Column_name.

2473


Tell me where we find the status of order information?

677






List the types of flexfield?

615


CAN YOU CUSTOMISE THE COUTOMISE CUS_TOP

2105


What do you understand by concurrent programs?

627


what is pay run id ?

1712


what is the difference between request group and request security in oracle apps?

5061


How can a process be deployed in soa?

704


A program must be written which accepts date parameter. The date parameter will accept data in the format DD/MM/YYYY. This data has to be validated and post validation, the following details have to be displayed for this date parameter 1. Input date must be defaulted to sysdate, It can be overridden by any other date. 2. Financial year should be displayed for this date parameter. Eg: If the input date is 30/11/2010, the financial year must be displayed as 1. From Date : 01-Aprr-2010 To Date: 31-Mar-2011 3. Calendar year and Calendar month must also be displayed. 4. The next payment cycle (say for EB), must be displayed based on this date parameter. 5. The previous payment must also be displayed based on this date.

1683


How to retry multiple errored workflow processes? What is the access level in workflow used for? How do you define start and end functions in workflow? How does they differ from normal functions? Give me some workflow tables? What is the difference between a function and notification in workflow? I have sent two different notifications to two different users and I want to wait till both they are approved to send 3rd notification. How can you achieve it? What is item type and item key in workflow? How do you use attribute values in workflow messages? How do you use lookups in workflow? What are roles in workflow and how they are used? How do you download or upload a workflow from a server? What are steps to customize the workflow? What functions can you perform from workflow administrator responsibility? To send an email to the user workflow notification is the only way or is there any other ways to send it? Give me some workflow standard procedures? How can you run/start/kickoff workflow? What is wf_engine package used for? How many processes can each workflow contain? What is Runnable option in workflow? At what level it exists? What are different types of attributes in workflow? How do you reassign a notification? What is process in workflow? How can you send direct oracle form link through workflow notifications? How can you send a notification to multiple users? Can you change the list dynamically? Can you send html code in workflow notification? I have sent two different notifications to two different users and I want to wait till atleast one is approved to send 3rd notification. How can you achieve it?

4323


Which oracle applications pl/sql standard apis you are familiar, have you used most of them?

640


Do you know what is applysys in oracle application database schema, what is apps?

685