Re: ISNULL() function for Oracle???

From: Sybrand Bakker <Sybrand.Bakker_at_Bentley.nl>
Date: 1995/09/27
Message-ID: <44b0v1$ap1_at_sun630.bentley.com>#1/1


Steve Perry <dpsmp_at_ix.netcom.com> wrote:
>In MS SQL Server, we use the function isnull(col1, "empty") in our select
>statements. Ex. select isnull(col1, "empty") from tbl1. This will replace
>all null rows returned with 'empty'. Is there a similar function in
>Oracle??? I've been looking, but I didn't see one.
>

Steve,

Here are some options you have:
- nvl(col1, "empty")
This one works fine if you only need to replace the null value by something else. SQL*Plus has an option somewhere to handle this by default, so if you're using plus you should be able to find a different solution that doesn't force you to write all your nvls - If you need to do additional processing based on null or non-null, the function decode offers an alternative. Decode more or less replaces iif. For this specific case the decode is:
decode(col1, null,"empty", col1)

Decode can be compared to a switch statement is access basic, "empty" being one of the case selectors and col1 one functioning as else. In a more normal case you can have statements like decode(expression, choice1, returnexp1,

                   choice2, returnexp2,
                   otherexp)

Hope this helps

Sybrand Bakker
Senior IS Analyst
Bentley Systems Europe
Hoofddorp
The Netherlands

#include <std_dclaimer.h> Received on Wed Sep 27 1995 - 00:00:00 CET

Original text of this message