<<Previous Next>>
Oracle - Can you pass a parameter to a cursor?
Explain with an explain - Feb 23, 2010 at 11:00 PM by
Rajmeet
Ghai
Can you pass a parameter to a cursor? Explain with an
explain.
A cursor can have a parameter in the IN mode.
Example: The cursor below accepts a parameter of data type
varchar2. cursor sample (v_key varchar2)
is select
initcap(book_title)
bk_title,
sum(quantity) sales,
author_key from
book join sales using
(book_key)
join book_author using
(book_key) where
author_key = v_key
group by initcap(book_title),
author_key;
Oracle - Can you pass a
parameter to a cursor? Explain with an explain - Feb 07,
2010 at 14:20 PM by Shuchi Gauri
Can you pass a parameter to a cursor? Explain with an
explain
Parameterized cursor:
/*Create
a table*/ create table Employee( ID VARCHAR2(4 BYTE)NOT
NULL, First_Name VARCHAR2(10 BYTE) );
/*Insert some data*/ Insert into Employee
(ID, First_Name) values (‘01’,’Harry’);
/*create cursor*/ declare cursor
c_emp(cin_No NUMBER)is select count(*) from employee where
id=cin_No; v_deptNo employee.id%type:=10; v_countEmp
NUMBER; begin open c_emp (v_deptNo); fetch c_emp into
v_countEmp; close c_emp; end;
/*Using cursor*/ Open c_emp (10);
Oracle - Can
you pass a parameter to a cursor? Explain with an
explain - April 10, 2009 at 11:00
AM
Can you pass a parameter to a cursor?
Explain with an explain
Yes, explicit cursors can take
parameters.
Also read
What a SELECT FOR UPDATE cursor represent?, What WHERE CURRENT OF
clause does in a cursor?, Can you pass a parameter to a cursor?,
Explain the functioning of CURSOR FOR LOOP with example., Define
Simple/Explicit , Parametric and Internal/Implicit
cursor.............
Normal cursors fall under the category of static cursors while
REF cursors are dynamic.........
A cursor variable works like pointer in C. It is used to hold
address of an item rather than the item itself. Cursor variables can
be used to hold different values at run time............
A parameter makes the cursor more reusable, A parameter avoids
scoping problems..............
Roles in Oracle can be used to grant privileges to a specific
group of users for security. The database manager is usually
responsible for granting privileges to a Role...........
|