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

Home -> Community -> Usenet -> c.d.o.server -> Re: Problem with Pro*C

Re: Problem with Pro*C

From: Allen Kirby <akirby_at_att.com>
Date: 1997/06/13
Message-ID: <33A18B27.4DF@att.com>#1/1

Balaji.S wrote:
>
> Hi,
> I am a newbie to Pro*C.
> I am having problems with Pro*C. I am using varchar variables in a loop
> and fetching records into those variables from a cursor. I am writing
> these variables to a text file for archival purposes. In-spite of NULL
> terminating these varchar variables, I find that in subsequent retrievals
> the old value contained in the varchar variable mix up with the newly
> fetched ones. variablename.arr will have both the old and the new values
> mixed up. Is there something very important i am missing.

You need to use indicator variables, and check these on each column after each fetch. This will tell you if the column is NULL or if a value was returned. If NULL, the old value won't be overwritten (there is nothing to overwrite it with). It can be a pain when there are a lot of variables, but this is the best way. You can use other tricks like resetting the length to 0, but it's not guaranteed that in the future Oracle won't change the way that works. The PRO*C manuals discuss these at length.

-- 
Allen Kirby			AT&T ITS Production Services
akirby_at_att.com			Alpharetta, GA.
Received on Fri Jun 13 1997 - 00:00:00 CDT

Original text of this message

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