Like with decode (merged) [message #376807] |
Thu, 18 December 2008 11:00 |
ORAGENASHOK
Messages: 240 Registered: June 2006 Location: Chennai
|
Senior Member |
|
|
I want to implement the LIKE functionality in single DECODE function.
I have one table t1 :
create table t1 (val varchar2(20))
insert into t1 values ('ORACLE')
/
insert into t1 values ('ASHOK')
/
select * from t1
-----------------
val
------
ORACLE
ASHOK
i want to implement the like functionality in single decode function as
if val like 'OR%' then
'F'
else
'S'
end if
can anyone help me to sort this its very urgent
[Updated on: Fri, 19 December 2008 00:42] by Moderator Report message to a moderator
|
|
|
|
|
|
Re: how the query is working ? using Decode [message #376874 is a reply to message #376862] |
Fri, 19 December 2008 00:37 |
trivendra
Messages: 211 Registered: October 2007 Location: Phoenix
|
Senior Member |
|
|
Hi Panyam,
You Query will run only when
select val from dual where val like 'OR%'
Return No Rows or 1 Rows Returned, Here what ever is the output it will always give 'S'. because val will returned with starting string with OR%
Thanks
Trivendra
|
|
|
|
|
|
|
|
|
|