ANY keywork doesn't work with LIKE?? (merged) [message #402623] |
Mon, 11 May 2009 12:40  |
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.
|
|
|
|
|
|
|
ANY keywork doesn't work with LIKE?? [message #402653 is a reply to message #402623] |
Mon, 11 May 2009 21:05   |
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 keyword not works in LIKE condition [message #402668 is a reply to message #402626] |
Tue, 12 May 2009 00:17   |
Frank
Messages: 7901 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.
|
|
|
|