CURSOR PARAMETERS
CURSOR WITH PARAMETERS:
A cursor can be declare with parameters.
Note:
A cursor can be declare with parameters.
Note:
- cursor parameters can be assigned default values.
- the scope of the cursor parameters is local to the cursor
- the mode of the parameters can only be IN.
Example:
Declare
Cursor c1 (p_deptno emp.deptno%type) is
select ename,sal,deptno
from emp
where deptno=p_deptno;
begin
for i in c1 (10) loop
dbms_output.put_line(i.ename||' '||i.sal||' '||i.deptno);
end loop;
for i in c1(20) loop
dbms_output.put_line(i.ename||' '||i.sal||' '||i.deptno);
end loop;
dbms_output.put_line('hai');
end;
/
Comments
Post a Comment