Oracle FAQ Your Portal to the Oracle Knowledge Grid
HOME | ASK QUESTION | ADD INFO | SEARCH | E-MAIL US
 

Home -> Community -> Usenet -> c.d.o.misc -> Easy DECODE query (hopefully)...

Easy DECODE query (hopefully)...

From: <dolans_at_my-deja.com>
Date: Mon, 13 Mar 2000 14:47:39 GMT
Message-ID: <8aiv29$rku$1@nnrp1.deja.com>


I have a table:
FOO



ID
THE_VALUE If I do a :
"Select decode(id, NULL, 0, 1) from FOO where THE_VALUE='Mom';"

I get no rows selected. I would like it to return 0 if there is no entry in the table for 'Mom'.

Is NULL the correct expression? Yes, I could use count(Id) in the search expression instead, but I am trying to return the ID if it exists or 0 if it doesn't.

Thanks,
Sean Dolan

Sent via Deja.com http://www.deja.com/
Before you buy. Received on Mon Mar 13 2000 - 08:47:39 CST

Original text of this message

HOME | ASK QUESTION | ADD INFO | SEARCH | E-MAIL US