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 -> Re: what value to use in NVL for columns that may contain a NULL

Re: what value to use in NVL for columns that may contain a NULL

From: Calvin Crumrine <Calvin_Crumrine_at_dced.state.ak.us>
Date: Thu, 13 Sep 2001 14:30:35 -0800
Message-ID: <3BA1338B.778AF3EF@dced.state.ak.us>


FWIW I have problems similar to NeelSing except I work in Pro*COBOL and VB. I'm aware of the indicators & currently use them, but they're very clumsy. Every check requires 2 tests: Does the indicator show a value is present and if it does, is the value the one I want? Using NVL ensures that every record returns a value for the specified field and eliminates one of the tests.

Like NeelSing, sometimes what I'd prefer NVL to return is an empty string, but I've found no way to do that. I believe that the problem is that Oracle implements Null as an empty string even though the SQL standard specifically says that it's different. (I could be wrong about this-I remember hearing it but can't seem to track it down again.)

Xavier Neys wrote:

> Check your Pro*C for indicators.
> They are flags "attached" to the variables you select into and are used by Pro*C to let you know when a column is NULL.
>
> HTH,
>
> --
> Today, Tomorrow, Together
> The DOC
> (The Dutch Oracle Company)
>
> Xavier
>
> "NeelSing" <bytetwo_at_hotmail.com> wrote in message news:d3852a1b.0109131031.66eb3eef_at_posting.google.com...
> > In Pro*C,
> > EXEC SQL DECLARE myCursor CURSOR FOR
> > SELECT NVL( db_field, ??),
> >
> > ...
> > ...
> > so that I may detect the value read as an empty string
> >
> > strcmp(var_db_field_read_in, "") == 0
> > ...
> > Please suggest.
> >
> > Cheers!
Received on Thu Sep 13 2001 - 17:30:35 CDT

Original text of this message

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