Home » SQL & PL/SQL » SQL & PL/SQL » HELP STATEMENT WITH IN (merged)
HELP STATEMENT WITH IN (merged) [message #240154] Thu, 24 May 2007 04:38 Go to next message
shanthkumaar
Messages: 156
Registered: February 2007
Location: india,chennai
Senior Member

hi experts,


i have a doubt. and i am explaining it here

declare
 c3 integer;
 CURSOR user_list(emp varchar2)
 is
 select ename from emps
 where
 emp_no=emp;
 begin
 for c3 in user_list('1') loop
 DBMS_OUTPUT.PUT_line(c3.ename||',');
 end loop;
 end;

output
----------------
shanth,



In the above procedure
for c3 in user_list('1')
iam setting the value 1 to emp and the result comes fine
but i have to give more than one values like
for c3 in user_list('1,2')
and so can use the keyword like the below

emp_no like emp;

how can i do this.
guide me.

i have attached the create and insert table script.

my version
SQL> select banner from v$version;

BANNER
----------------------------------------------------------------
Oracle9i Enterprise Edition Release 9.2.0.5.0 - Production
PL/SQL Release 9.2.0.5.0 - Production
CORE 9.2.0.6.0 Production
TNS for Linux: Version 9.2.0.5.0 - Production
NLSRTL Version 9.2.0.5.0 - Production


regards
shanth

[Updated on: Thu, 24 May 2007 04:43]

Report message to a moderator

Re: doubt in passing the values [message #240156 is a reply to message #240154] Thu, 24 May 2007 04:42 Go to previous messageGo to next message
Michel Cadot
Messages: 68718
Registered: March 2007
Location: Saint-Maur, France, https...
Senior Member
Account Moderator
You'll get an answer in thread varying elements in IN list on AskTom.

Regards
Michel

[Updated on: Thu, 24 May 2007 06:11]

Report message to a moderator

Re: doubt in passing the values [message #240191 is a reply to message #240156] Thu, 24 May 2007 06:06 Go to previous messageGo to next message
shanthkumaar
Messages: 156
Registered: February 2007
Location: india,chennai
Senior Member

Thanks Michel. Laughing
iam looking into it.

regards
shanth
icon5.gif  HELP STATMENT WITH IN [message #240451 is a reply to message #240154] Thu, 24 May 2007 19:51 Go to previous messageGo to next message
frankrac
Messages: 2
Registered: May 2007
Junior Member
Please,
This statment with IN, not work.

create or replace procedure TEST is
begin
declare
cursor c1(a varchar2) is
select *
from tab_country
where cod_country in (a);

x varchar2(100);

begin
x:= ''''||'02'||''''||''''||'04'||'''';
for r in c1(x) loop
null;
-- others stm
end loop;
end;
end TEST;
Re: HELP STATMENT WITH IN [message #240452 is a reply to message #240451] Thu, 24 May 2007 19:54 Go to previous messageGo to next message
BlackSwan
Messages: 26766
Registered: January 2009
Location: SoCal
Senior Member
my car does not work.
please tell me how to fix it.
Please read & FOLLOW the posting guidelines as stated in #1 STICKY post at top of this forum.
Re: HELP STATMENT WITH IN [message #240453 is a reply to message #240452] Thu, 24 May 2007 20:00 Go to previous messageGo to next message
frankrac
Messages: 2
Registered: May 2007
Junior Member
The program does not enter the sentences of loop
Re: HELP STATMENT WITH IN [message #240455 is a reply to message #240451] Thu, 24 May 2007 20:58 Go to previous message
flyboy
Messages: 1903
Registered: November 2006
Senior Member
It seems to be the same issue as in this thread.
Also found How can I do a variable "in list" thread on AskTom dealing the same issue.
Previous Topic: DB LINK for OPS$ user
Next Topic: Help in writing a trigger
Goto Forum:
  


Current Time: Thu Dec 05 17:12:58 CST 2024