-
Hi,
I need to write a decode statement which does the following:
Returns elec_id if elec_id is not null in the database, and gas_id if elec_id is null.
How do I do that?
Thanks in advance,
Boris
-
select decode(elec_id,null,gas_id,elec_id) from table_name;
What this says in pseudocode is:
If elec_id is null then
use gas_id
else
use elec_id
end;
-
Thank you very much.
Boris
-
Isn't that what NVL() function is all about? No need for DECODE or other fancy stuf in this case...
SELECT NVL(elec_id, gas_id) FROM table_name;
Jurij Modic
ASCII a stupid question, get a stupid ANSI
24 hours in a day .... 24 beer in a case .... coincidence?
Posting Permissions
- You may not post new threads
- You may not post replies
- You may not post attachments
- You may not edit your posts
-
Forum Rules
|
Click Here to Expand Forum to Full Width
|