Re: Oracle Pro*C
Date: 10 Feb 93 18:34:57 GMT
Message-ID: <1993Feb10.183457.15613_at_kaija.spb.su>
rtan_at_polaris.utswrk (Rick Tan) 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];
: EXEC SQL END DECLARE SECTION;
Try to describe 'char *name;'
: .
: strcpy(name,"Any Valid Name");
Here use 'name = strdup("Any valid Name");' instead your line.
:
: 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?
: Thanks.
:
: Rick
:
:
:
Try to set up option EXEC ORACLE OPTION (REBIND=YES) in the top
of your program.
If above idea does not work try following:
Describe your variable as 'VARCHAR name[20]' Then copy value: 'strcpy(name.arr,"Any valid name")' And define the length: 'name.len = strlen(name.arr)'
Do not forget to set rebind option up.
Hope this helps.
Nick Maximov
Oracle DBA at Kaija Soft, Ltd
E-mail: nick_at_adnserv.kaija.spb.su
Phone: +7(812) 177 74 37
-- Nick Maximov St. Petersburg, RussiaReceived on Wed Feb 10 1993 - 19:34:57 CET