CURSOR PARAMETERS

CURSOR WITH  PARAMETERS:

A cursor can be declare with parameters.

Note:
  1. cursor parameters can be assigned default values.
  2. the scope of the cursor  parameters is local to the cursor
  3. 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

Popular posts from this blog

PRAGMA SERIALLY_REUSABLE

COLLECTION METHODS