Home » SQL & PL/SQL » SQL & PL/SQL » SQL
SQL [message #236604] Thu, 10 May 2007 06:22 Go to next message
kr_arvind
Messages: 85
Registered: April 2006
Location: Delhi
Member
Hi All,

Is it possible use conditional operator in decode function ?
I need all customer but filteration according to conditions.

INPUT
cust_name hiredate
a 10/10/2006
b 10/10/2003
c 10/10/2004

OUTPUT
cust_name hiredate Remark
a 10/10/2006 OLD
b 02/02/2007 NEW
c 12/02/2007 NEW


Condition wth decode function

decode(hiredate, hiredate < 02/02/2007, 'OLD','NEW')

Please help for the same how can use decode funtion in above case.


Thnaks & Regards,
Arvind Kumar


Re: SQL [message #236606 is a reply to message #236604] Thu, 10 May 2007 06:28 Go to previous messageGo to next message
Michel Cadot
Messages: 64122
Registered: March 2007
Location: Nanterre, France, http://...
Senior Member
Account Moderator
No.
Either use CASE, more powerful than DECODE, or use SIGN.

Regards
Michel
Re: SQL [message #236995 is a reply to message #236604] Fri, 11 May 2007 09:35 Go to previous messageGo to next message
joy_division
Messages: 4641
Registered: February 2005
Location: East Coast USA
Senior Member
I see you're still using 100% unhelpful non-descriptive titles to your posts.
And you would not be able to compare a DATE to a character string nevertheless.
Re: SQL [message #236998 is a reply to message #236604] Fri, 11 May 2007 09:52 Go to previous message
Bill B
Messages: 1484
Registered: December 2004
Senior Member
decode (greatest(to_date('02/02/2007','mm/dd/yyyy'),hiredate),to_date('02/02/2007','mm/dd/yyyy'),'OLD','NEW')

[Updated on: Fri, 11 May 2007 09:53]

Report message to a moderator

Previous Topic: Join tables (merge)
Next Topic: What problem can you see?
Goto Forum:
  


Current Time: Wed Dec 07 05:06:54 CST 2016

Total time taken to generate the page: 0.29039 seconds