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: OCI question: about null string

Re: OCI question: about null string

From: Justin Cave <jocave_at_yahoo.com>
Date: 29 Nov 2002 13:53:27 -0800
Message-ID: <233b7a65.0211291353.3902e8f@posting.google.com>


"music4" <cli4_at_lucent.com> wrote in message news:<as43ld$a7d_at_netnews.proxy.lucent.com>...
> Dear all,
>
> This is a question about OCI.
>
> I have a field of VARCHAR typed, and it can be null or empty string. I write
> a OCI function using C language to select this field value. If the field is
> null, or empty string, I always get a error "ORA-01405: fetched colum value
> is NULL". So I have to use something like "NVL(the_field, '-9')" to get an
> alternate string. But here is it possible to let OCI just put a empty string
> in buffer (char [] typed). I tried "NVL(the_field, '')", it didn't work.

First off, a trip to tahiti.oracle.com is in order to look up the error message.

ORA-01405 fetched column value is NULL

Cause: The INTO clause of a FETCH operation contained a NULL value, and no indicator was used. The column buffer in the program remained unchanged, and the cursor return code was +2. This is an error unless you are running Oracle with DBMS=6, emulating version 6, in which case it is only a warning.

Action: You may do any of the following:

My guess is that you're not providing OCI with an indicator variable when you bind your char* buffer. This is the only way for OCI to tell you that you've fetched a NULL value (it doesn't change the data in the buffer you've passed in, so the buffer is likely to have garbage in it unless you've initialized it).

Justin Received on Fri Nov 29 2002 - 15:53:27 CST

Original text of this message

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