Home » SQL & PL/SQL » SQL & PL/SQL » Ref Cursors for passing parameters (Oracle 10.2.0.1.0)
Ref Cursors for passing parameters [message #580149] Wed, 20 March 2013 15:48 Go to next message
jay_cooldude
Messages: 50
Registered: March 2013
Location: Hyd
Member
declare 
 type ref_cur is ref cursor;
 r ref_cur;
 enam emp%rowtype;
 dno dept.deptno%type;
   begin
       dbms_output.put_line('The Employee details are'); 
          open r for select deptno from dept;
          loop
          fetch r into dno;
          exit when r%notfound;
               open r(dno) for select * from emp where deptno=dno;
               loop
               fetch r into enam;
               exit when r%notfound;
               dbms_output.put_line('Employee Name is '||enam.ename||'  Employee sal is '||enam.sal); 
              end loop; 
              end loop;    
          close r;
          close r;  
    end;

Error at line 1
ORA-06550: line 12, column 28:
PLS-00103: Encountered the symbol "FOR" when expecting one of the following:

   . ( % ;




IF I NEED TO USE REF CURSOR TO SEND PARAMETERS,IS IT POSSIBLE?
IF YES,HOW TO USE IT ?
Re: Ref Cursors for passing parameters [message #580150 is a reply to message #580149] Wed, 20 March 2013 16:51 Go to previous messageGo to next message
Solomon Yakobson
Messages: 2033
Registered: January 2010
Senior Member
Open manual and you will find out. OPEN FOR Statement

SY.
Re: Ref Cursors for passing parameters [message #580162 is a reply to message #580149] Thu, 21 March 2013 00:03 Go to previous messageGo to next message
delna.sexy
Messages: 941
Registered: December 2008
Location: Surat, The Diamond City
Senior Member
you have to use Parametrized Cursor for passing arguments. Search for it.

regards,
Delna

[Updated on: Thu, 21 March 2013 00:03]

Report message to a moderator

Re: Ref Cursors for passing parameters [message #580166 is a reply to message #580149] Thu, 21 March 2013 01:26 Go to previous message
Michel Cadot
Messages: 59199
Registered: March 2007
Location: Nanterre, France, http://...
Senior Member
Account Moderator
Do NOT post in UPPER case.
Please read OraFAQ Forum Guide.

2 good books for you:
PL/SQL User's Guide and Reference
Application Developer's Guide - Fundamentals

Regards
Michel
Previous Topic: how we create rank on column without using rownum function and rank function.
Next Topic: retrieving data from pl sql table
Goto Forum:
  


Current Time: Tue Sep 23 13:49:44 CDT 2014

Total time taken to generate the page: 0.27219 seconds