Home » SQL & PL/SQL » SQL & PL/SQL » ANY keywork doesn't work with LIKE?? (merged)
ANY keywork doesn't work with LIKE?? (merged) [message #402623] Mon, 11 May 2009 12:40 Go to next message
bankarsenal
Messages: 2
Registered: May 2009
Junior Member
Assume I have a following table..

id name value
----------------------------------
001 hello001 5
002 hello002 8
003 hello003 4


select a.id
from table_a a
where ab.id like ANY('001','002')


This statement from my understanding should have worked fine
but it informs error ORA-00936 missing expression
I'm not sure if using ANY keyword with LIKE is permissible in
Oracle.
Any help would be appreciated. Thank in advance.
Re: ANY keyword not works in LIKE condition [message #402625 is a reply to message #402623] Mon, 11 May 2009 12:44 Go to previous messageGo to next message
BlackSwan
Messages: 25046
Registered: January 2009
Location: SoCal
Senior Member
eliminate ANY from SQL statement.
Re: ANY keyword not works in LIKE condition [message #402626 is a reply to message #402623] Mon, 11 May 2009 12:45 Go to previous messageGo to next message
joy_division
Messages: 4643
Registered: February 2005
Location: East Coast USA
Senior Member
ANY? What is that? A Sqlserver command? This is an Oracle forum. do you mean IN?

[Updated on: Mon, 11 May 2009 12:48]

Report message to a moderator

Re: ANY keyword not works in LIKE condition [message #402629 is a reply to message #402623] Mon, 11 May 2009 12:48 Go to previous messageGo to next message
Michel Cadot
Messages: 64139
Registered: March 2007
Location: Nanterre, France, http://...
Senior Member
Account Moderator
Use IN instead of LIKE ANY.

Regards
Michel
Re: ANY keyword not works in LIKE condition [message #402633 is a reply to message #402629] Mon, 11 May 2009 13:02 Go to previous messageGo to next message
B.T.S.Ananth
Messages: 216
Registered: June 2006
Location: chennai / Hyderabad
Senior Member

select a.id
from table ab a
where a.id IN('001','002')
ANY keywork doesn't work with LIKE?? [message #402653 is a reply to message #402623] Mon, 11 May 2009 21:05 Go to previous messageGo to next message
bankarsenal
Messages: 2
Registered: May 2009
Junior Member
Assume I have a following table named table_a ..

id name value
----------------------------------
001 hello001 5
002 hello002 8
003 hello003 4

and my code is...

select a.id
from table_a a
where ab.id like ANY('001','002')


This statement from my understanding should have worked fine
but it informs error ORA-00936 missing expression
I'm not sure if using ANY keyword with LIKE is permissible in
Oracle. I love using ANY keywork because it makes my code succinct.
Any help would be appreciated. Thank in advance.
Re: ANY keywork doesn't work with LIKE?? [message #402654 is a reply to message #402653] Mon, 11 May 2009 21:09 Go to previous messageGo to next message
BlackSwan
Messages: 25046
Registered: January 2009
Location: SoCal
Senior Member
http://www.orafaq.com/forum/t/145023/136107/

Do NOT cross/multi-post!

You need to help us by following the Posting Guidelines as stated below.
http://www.orafaq.com/forum/t/88153/0/
Re: ANY keyword not works in LIKE condition [message #402668 is a reply to message #402626] Tue, 12 May 2009 00:17 Go to previous messageGo to next message
Frank
Messages: 7880
Registered: March 2000
Senior Member
joy_division wrote on Mon, 11 May 2009 19:45
ANY? What is that? A Sqlserver command? This is an Oracle forum. do you mean IN?

Actually, ANY is Oracle syntax as well:
SQL> select ename from emp;

ENAME
----------
SMITH
ALLEN
WARD
JONES
MARTIN
BLAKE
CLARK
SCOTT
KING
TURNER
ADAMS
JAMES
FORD
MILLER

14 rows selected.

SQL> select ename from emp where ename = any ('JAMES', 'FORD')
  2  /

ENAME
----------
JAMES
FORD

SQL> select ename from emp where ename like any ('JAMES', 'FORD')
  2  /
select ename from emp where ename like any ('JAME%', 'FOR%')
                                       *
ERROR at line 1:
ORA-00936: missing expression

@bankarsenal: It seems clear that any can't be used with like.
Re: ANY keyword not works in LIKE condition [message #402846 is a reply to message #402668] Tue, 12 May 2009 13:57 Go to previous message
B.T.S.Ananth
Messages: 216
Registered: June 2006
Location: chennai / Hyderabad
Senior Member

Thank you Frank
Previous Topic: Update with Sequence using Order By
Next Topic: Oracle_XML
Goto Forum:
  


Current Time: Thu Dec 08 18:26:18 CST 2016

Total time taken to generate the page: 0.09026 seconds