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
Is soa a part of oracle fusion middleware?
can we get profile values in report without using user exists is it possible how?
What do you understand by soa?
What is count(*) from po_vendors(any table)?
List the various types of value set.
what is the difference between request group and request security in oracle apps?
What are file in oracle.
please any one provide the oracle erp technical interview questions on modules(PO,AP,AR,INV,GL,OM)wise to my mail id..narendra_609@yahoo.co.in
how can develope the po variance and po summary report? with tables mandatory columns and query please?
What are the different components of soa suite?
What are do's and dont's of Interface?
where to define interorganization transaction charges and what are the different options?
In hierarchical structure of a database? we have write query from where we should start?
Which oracle applications pl/sql standard apis you are familiar, have you used most of them?
Can you differentiate between mediator and osb?