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

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

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

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: 65079
Registered: March 2007
Location: Nanterre, France, http://...
Senior Member
Account Moderator
Either use CASE, more powerful than DECODE, or use SIGN.

Re: SQL [message #236995 is a reply to message #236604] Fri, 11 May 2007 09:35 Go to previous messageGo to next message
Messages: 4758
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: 1648
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: Fri Jul 21 00:01:07 CDT 2017

Total time taken to generate the page: 0.06227 seconds