Home » SQL & PL/SQL » SQL & PL/SQL » using vaiable for IN query (Oracle 9i)
using vaiable for IN query [message #309851] Sat, 29 March 2008 04:30 Go to next message
rekhau
Messages: 4
Registered: October 2007
Junior Member
Hi,

I have a select query as mentioned below:

SELECT * FROM EMP WHERE DEPTNO IN @var

here @var=(10,20,30).

This is just an example actually the varible contains list of 10-12 values.

When I execute the select query I get error.

Without splitting the varibale how do I write the query & I do not know what values might come in @var.

Thanks in advance.

Please help asap.
Re: using vaiable for IN query [message #309852 is a reply to message #309851] Sat, 29 March 2008 04:40 Go to previous messageGo to next message
dhananjay
Messages: 635
Registered: March 2002
Location: Mumbai
Senior Member
check this link.
LINK

regards,
Re: using vaiable for IN query [message #309867 is a reply to message #309851] Sat, 29 March 2008 08:08 Go to previous messageGo to next message
pablolee
Messages: 2834
Registered: May 2007
Location: Scotland
Senior Member
This looks like sql server and T- SQL syntax, is that correct?
Re: using vaiable for IN query [message #310034 is a reply to message #309867] Mon, 31 March 2008 00:37 Go to previous messageGo to next message
rekhau
Messages: 4
Registered: October 2007
Junior Member
Sorry I wrote in T-SQl Syntax.
I need it in Oracle.
Re: using vaiable for IN query [message #310042 is a reply to message #310034] Mon, 31 March 2008 01:03 Go to previous message
Michel Cadot
Messages: 64119
Registered: March 2007
Location: Nanterre, France, http://...
Senior Member
Account Moderator
So read the link above or search here for "varying in list" or the like.

Regards
Michel
Previous Topic: Relation beween ORA-01555 and ORA-01427
Next Topic: email validation
Goto Forum:
  


Current Time: Tue Dec 06 08:52:27 CST 2016

Total time taken to generate the page: 0.12826 seconds