Re: VARCHAR behaviour

From: James A. Johnson <nimbus3_at_bellsouth.net>
Date: 1998/12/08
Message-ID: <366C8C80.FDE85A7D_at_bellsouth.net>#1/1


CHAR acts differently that earlier versions and Oracle recommends using the VARCHAR2 function to do anything. CHAR adds padded characters whereas VARCHAR2 doesnot

Programming wrote:

> I have a couple of questions regarding the use of Oracle 7.2 VARCHAR
> host variables in a C program on AIX/RS6000.
>
> 1. In a cursor fetch, I must use varchar and not char in my C program.
> Char works sometimes, but sometimes contains garbage values. Why is
> this?
>
> 2. I used strcpy as follows: STRCPY((CHAR *)VAR1.ARR,(CHAR *)VAR2.ARR);
> VAR2 was cursor fetched from Oracle, was null terminated, and has
> it's .LEN set by Oracle. VAR2 had it's .LEN set by me explicitally. In a
> subsequent STRCPY identical to the one above, or sometimes just for use
> in a "WHERE X=:VAR1" clause, I found that must explicitally set the
> .LEN again, even though it's value has not changed since the last set!
> The Oracle error I got was ORA - 01458.
>
> Any help would be greatly appreciated. Thanx.
Received on Tue Dec 08 1998 - 00:00:00 CET

Original text of this message