Home » SQL & PL/SQL » SQL & PL/SQL » How to use NOT NULL inside DECODE?
How to use NOT NULL inside DECODE? [message #248132] Thu, 28 June 2007 02:31 Go to next message
fortunethiyagu
Messages: 94
Registered: December 2006
Member


Hi,

DECODE(FIELD_1,NOT NULL,'working',NULL)

Is it possible to do such? else how to proceed so?

Re: How to use NOT NULL inside DECODE? [message #248136 is a reply to message #248132] Thu, 28 June 2007 02:37 Go to previous messageGo to next message
pablolee
Messages: 2882
Registered: May 2007
Location: Scotland
Senior Member
nvl2(field, 'working', null)
Re: How to use NOT NULL inside DECODE? [message #248145 is a reply to message #248136] Thu, 28 June 2007 03:02 Go to previous messageGo to next message
rleishman
Messages: 3728
Registered: October 2005
Location: Melbourne, Australia
Senior Member
Or
DECODE(field, NULL, NULL, 'Working')


Ross Leishman
Re: How to use NOT NULL inside DECODE? [message #248251 is a reply to message #248145] Thu, 28 June 2007 07:55 Go to previous messageGo to next message
joy_division
Messages: 4963
Registered: February 2005
Location: East Coast USA
Senior Member
Just to add some footnotes to Ross's answer. DECODE is theo nly place where you can compare a NULL to a NULL.
Re: How to use NOT NULL inside DECODE? [message #486243 is a reply to message #248132] Tue, 14 December 2010 07:36 Go to previous messageGo to next message
ignu
Messages: 3
Registered: October 2005
Junior Member
SELECT
CASE WHEN ' ' IS NOT NULL THEN 'working' ELSE NULL END
FROM dual
Re: How to use NOT NULL inside DECODE? [message #486244 is a reply to message #486243] Tue, 14 December 2010 07:38 Go to previous messageGo to next message
Michel Cadot
Messages: 68757
Registered: March 2007
Location: Saint-Maur, France, https...
Senior Member
Account Moderator
SELECT CASE WHEN field_1 IS NOT NULL THEN 'working' END
FROM dual

Smile

Regards
Michel

[Updated on: Tue, 14 December 2010 07:39]

Report message to a moderator

Re: How to use NOT NULL inside DECODE? [message #486245 is a reply to message #486244] Tue, 14 December 2010 07:44 Go to previous messageGo to next message
pablolee
Messages: 2882
Registered: May 2007
Location: Scotland
Senior Member
Really? a Three and a half year old thread re-animated for this?
Re: How to use NOT NULL inside DECODE? [message #486251 is a reply to message #486245] Tue, 14 December 2010 08:11 Go to previous messageGo to next message
Michel Cadot
Messages: 68757
Registered: March 2007
Location: Saint-Maur, France, https...
Senior Member
Account Moderator
"ignu" waked up after 5 years of hibernation, so a 3.5 years old topic is very new. Laughing

Regards
Michel
Re: How to use NOT NULL inside DECODE? [message #486275 is a reply to message #486251] Tue, 14 December 2010 10:35 Go to previous messageGo to next message
ThomasG
Messages: 3212
Registered: April 2005
Location: Heilbronn, Germany
Senior Member
Naahhhhhhh, probably just his browser hanging for 3.5 years, and the post finally came through. Very Happy
Re: How to use NOT NULL inside DECODE? [message #486548 is a reply to message #486275] Thu, 16 December 2010 08:08 Go to previous message
Bill B
Messages: 1971
Registered: December 2004
Senior Member
ThomasG wrote on Tue, 14 December 2010 10:35
Naahhhhhhh, probably just his browser hanging for 3.5 years, and the post finally came through. Very Happy


Must have been an IE session, try firefox. LOL
Previous Topic: how to get last 4 charecters in a string.but i dont know the length
Next Topic: Finding duplicate only records in more than one column
Goto Forum:
  


Current Time: Sat Apr 26 00:32:51 CDT 2025