Home » SQL & PL/SQL » SQL & PL/SQL » can i use multiple LIKE operator in select query
can i use multiple LIKE operator in select query [message #246398] Wed, 20 June 2007 15:34 Go to next message
NIckman
Messages: 64
Registered: May 2007
Member
i need retrive the date from oracle table
based on partial name column

select name,staus,begin,end

from emptab

where name is like 'joh%'
and name is not like 'joha?ath'
and name is not like 'jobb??m'

order by name;

And also the count the no of rows returned.

select 'no pf rows is returned' count(*)
from emptab

where name is like 'joh%'
and name is not like 'joha?ath'
and name is not like 'jobb??m'

order by name;

is this statements are right?

MY ? can i use multiple like parameter for looking for particular name criteria?

thx.N.
Re: can i use multiple LIKE operator in select query [message #246401 is a reply to message #246398] Wed, 20 June 2007 15:44 Go to previous messageGo to next message
Michel Cadot
Messages: 64117
Registered: March 2007
Location: Nanterre, France, http://...
Senior Member
Account Moderator
Replace ? by _. This is the joker character.

Regards
Michel
Re: can i use multiple LIKE operator in select query [message #246421 is a reply to message #246398] Wed, 20 June 2007 17:42 Go to previous messageGo to next message
NIckman
Messages: 64
Registered: May 2007
Member
it is typo error.

select name,staus,begin,end

from emptab

where name is like 'joh%'
and name is not like 'joha_ath'
and name is not like 'jobb_m'

order by name;

And also the count the no of rows returned.

select 'no pf rows is returned' count(*)
from emptab

where name is like 'joh%'
and name is not like 'joha_ath'
and name is not like 'jobb_m'

order by name;
Re: can i use multiple LIKE operator in select query [message #246423 is a reply to message #246398] Wed, 20 June 2007 17:53 Go to previous messageGo to next message
BlackSwan
Messages: 25039
Registered: January 2009
Location: SoCal
Senior Member
Unless & until you follow the posting guidelines as enumerated in the STICKY posts at the top of this forum, You're On Your Own (YOYO)!
Re: can i use multiple LIKE operator in select query [message #246474 is a reply to message #246398] Thu, 21 June 2007 01:23 Go to previous message
flyboy
Messages: 1832
Registered: November 2006
Senior Member
No, if it is logically correct, there is no problem in multiple LIKE conditions.
SQL> select * from dual where dummy is like 'X%';
select * from dual where dummy is like 'X%'
                                  *
ERROR at line 1:
ORA-00908: missing NULL keyword

It is funny you suspect it as even a SINGLE LIKE condition (written with your syntax) fails. Why did you not share it here (as anacedent pointed out)?

Hint: SQL Reference Guide, LIKE Condition, found for example on http://tahiti.oracle.com/.
For your second example also consult the same book, section SQL Statements, SELECT, select_list.
Previous Topic: oracle data block
Next Topic: Change primary key value
Goto Forum:
  


Current Time: Tue Dec 06 04:26:25 CST 2016

Total time taken to generate the page: 0.08414 seconds