Skip to Main Content

SQL & PL/SQL

Announcement

For appeals, questions and feedback about Oracle Forums, please email oracle-forums-moderators_us@oracle.com. Technical questions should be asked in the appropriate category. Thank you!

Passing string to a cursor as parameter

Lokanath GiriJul 22 2010 — edited Jul 23 2010
Hi,
need some help

Version:Oracle Database 10g Enterprise Edition Release 10.2.0.1.0
DECLARE
	lv_dept VARCHAR2(100);
	Currec EMP%ROWTYPE;
	Cursor Cur_Dept(pv_dept VARCHAR2) IS SELECT * FROM EMP WHERE to_char(deptno) IN (pv_dept); 
BEGIN
   lv_dept:='''10'''||','||'''20''';
 	 OPEN Cur_Dept(lv_dept);
   LOOP
  	 FETCH Cur_Dept INTO Currec;
                 Message(Currec.Ename||Currec.deptno); --Forms code
	 EXIT WHEN Cur_Dept%NOTFOUND;	
   END LOOP;
   close Cur_Dept;
END;	
 
If I pass the parameter as a string , it doesn't work.

Regards,
Lokanath
This post has been answered by BluShadow on Jul 23 2010
Jump to Answer
Comments
Locked Post
New comments cannot be posted to this locked post.
Post Details
Locked on Aug 20 2010
Added on Jul 22 2010
12 comments
7,950 views