Home » SQL & PL/SQL » SQL & PL/SQL » like clause
like clause [message #237306] Mon, 14 May 2007 02:34 Go to next message
u263066
Messages: 47
Registered: March 2007
Member
I have query like:
 SELECT Cust_Trx_Type_Id
 FROM   Ra_Cust_Trx_Types
 WHERE  Name = lEntCode||' '||'REBATE';



THERE IS ALWAYS 3 ALPHA NUMARIC, VALUE COMING FOR lEntCode

ie like,
11A REBATE
12A REBATE
..

Can any one suggest how to make a clause in like

Name like above string in join condition.

as there are also few data exist in the column like

11A REBATE
12A INVOICE REBATE
13C REBATE
15D REBATE REVERAL
18E PRICING REBATE
76A REBATE


my candidate should be only from above data set would be
11A REBATE
13C REBATE
76A REBATE


any help
Re: like clause [message #237308 is a reply to message #237306] Mon, 14 May 2007 02:38 Go to previous messageGo to next message
Michel Cadot
Messages: 64151
Registered: March 2007
Location: Nanterre, France, http://...
Senior Member
Account Moderator
name like '___ REBATE'

Btw, NAME is a reserved word, don't use it.

Regards
Michel

[Updated on: Mon, 14 May 2007 02:39]

Report message to a moderator

Re: like clause [message #237312 is a reply to message #237308] Mon, 14 May 2007 02:42 Go to previous messageGo to next message
u263066
Messages: 47
Registered: March 2007
Member
Michel
just to clarify
name like '___ REBATE'

is working fine

what about those which has space between two words
would be required to make additional _ in the like string, or query will juts bypass the space between the words
Moreover thanks a lot
Re: like clause [message #237332 is a reply to message #237312] Mon, 14 May 2007 03:11 Go to previous messageGo to next message
Michel Cadot
Messages: 64151
Registered: March 2007
Location: Nanterre, France, http://...
Senior Member
Account Moderator
I don't understand your question.
_ in like means any character.

Regards
Michel
Re: like clause [message #237336 is a reply to message #237308] Mon, 14 May 2007 03:31 Go to previous messageGo to next message
malakolama
Messages: 16
Registered: May 2007
Location: sri lanka
Junior Member

michel is right. No it wont return your
INVOICE REBATE,REBATE REVERAL, PRICING REBATE lines
since it will check for 3 chars and a space and then the word rebate only. Any lines with any other words in front (INVOICE REBATE for example) or behind( REBATE REVERAL) will not get picked to the query result.
Re: like clause [message #237342 is a reply to message #237336] Mon, 14 May 2007 03:46 Go to previous messageGo to next message
tarmenel
Messages: 63
Registered: February 2007
Location: Israel
Member

would '%REBATE' not also help??
Re: like clause [message #237354 is a reply to message #237342] Mon, 14 May 2007 04:14 Go to previous messageGo to next message
Michel Cadot
Messages: 64151
Registered: March 2007
Location: Nanterre, France, http://...
Senior Member
Account Moderator
It is useful for some questions not for the OP one.

Regards
Michel
Re: like clause [message #237369 is a reply to message #237354] Mon, 14 May 2007 04:58 Go to previous messageGo to next message
tarunj
Messages: 23
Registered: April 2007
Location: Noida
Junior Member
use like '%REBATE%'

Cool

[Updated on: Mon, 14 May 2007 04:58]

Report message to a moderator

Re: like clause [message #237377 is a reply to message #237306] Mon, 14 May 2007 05:24 Go to previous messageGo to next message
pablolee
Messages: 2836
Registered: May 2007
Location: Scotland
Senior Member
Quote:
It is useful for some questions not for the OP one.
Laughing
Laughing

Quote:
use like '%REBATE%'
No, don't as this will not get the required answer.
Re: like clause [message #237623 is a reply to message #237377] Tue, 15 May 2007 04:33 Go to previous message
tarmenel
Messages: 63
Registered: February 2007
Location: Israel
Member

Sorry didn't read the question carefully enough
Previous Topic: How to create triggers
Next Topic: Simple Trigger Help Needed
Goto Forum:
  


Current Time: Fri Dec 09 19:37:51 CST 2016

Total time taken to generate the page: 0.08511 seconds