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
What are the Standard Reports and Forms in HRMS?
If we have a repeated record in a table. But the repeated record how i can transfer from table to nested table?
What is a value set? List its various types.
what is global tempory table?
How to create a purchase order without a requisition?
please send me forms, xml pulisher questions,answers
In support project one ticket alloted which steps follows manualy tell me ?
What is oracle soa suite and what are its different components?
What are the different components you should consider while defining a responsibility in oracle apps?
What is a flexfield? List out its types.
can we get profile values in report without using user exists is it possible how?
CAN YOU CUSTOMISE THE COUTOMISE CUS_TOP
What do you understand by concurrent programs?
Pls tel me the best text book for Oracle Apps 11i Tech? & I want D2K Text book also?
how can i print random rows in plsql table