Re: Oracle Pro*C
Date: Wed, 10 Feb 1993 15:30:46 GMT
Message-ID: <1993Feb10.153046.8658_at_magnus.acs.ohio-state.edu>
In article <25Yr03M.ca9J00_at_amdahl.uts.amdahl.com> rtan_at_polaris.utswrk writes:
>I have a problem that is close to driving me nuts. I've coded a C program with Embedded SQL that
>goes like this:
>
> EXEC SQL BEGIN DECLARE SECTION;
> char name[20];
This should be varchar name[20]; This will create a structure like:
struct {
int len;
char arr[20];
} name;
> EXEC SQL END DECLARE SECTION;
> .
> .
> strcpy(name,"Any Valid Name");
Make this strcpy(name.arr, "Any Valid Name"); followed by name.len = strlen(name.arr);
>
>
> EXEC SQL INSERT INTO mytable (name) VALUES (:name);
> EXEC SQL COMMIT WORK REPLACE;
>
>
>The row is inserted with no problem. However, the field in the row only shows "ny Valid Name". The
>field is defined as "NAME CHAR(20)". Does anyone know what is happening here?
Oracle stores strings as a length byte followed by an array of characters.
>Thanks.
>
>Rick
>
No Problem.
Kevin Received on Wed Feb 10 1993 - 16:30:46 CET