Oracle FAQ | Your Portal to the Oracle Knowledge Grid |
![]() |
![]() |
Home -> Community -> Usenet -> c.d.o.server -> Re: Help. How to search for text with a CASE WHEN cmd?
"Greg" <esabens_at_yahoo.com> wrote in message
news:1143730851.906778.86500_at_v46g2000cwv.googlegroups.com...
:I need to a way to search for a specific word within a field using a
: CASE WHEN command within the SELECT section of an SQL query. For
: example, let's say the field looks like:
:
: '234234-Greg-325123616-1341436-234324-43-Don-235161436-2436-2346-435'
:
: What I need to be able to do is have a CASE WHEN command that would
: work something like this:
:
: case when (x.field contains 'Greg' and x.field contains 'Don') then 1
: else 0
:
: What command is there that can be used in place of the hypothetical
: 'contains' command that I used in the above example?
:
: Thanks.
:
something like this:
select
case
when username like 'FLOW%'
then 'HTML DB'
else 'other'
end as usertype
, username
from all_users
bottom line, you can use standard WHERE-clause predicates and most if not all scalar functions in the WHEN clause -- you can even use scalar sub-queries
++ mcs Received on Thu Mar 30 2006 - 09:06:56 CST
![]() |
![]() |