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: help me!!! how can I insert data(pro*c)?

Re: help me!!! how can I insert data(pro*c)?

From: Johan Thorselius <johan.thorselius_at_outright.se>
Date: Tue, 05 Jan 1999 15:00:31 +0100
Message-ID: <36921AFE.DEB42F68@outright.se>


Try using VARCHAR(2) for sql_dr_acc-type, but keep char(1) in the datamodel (check the Pro*c sample code, there are good simple samplecode). Also check which switches you have for the precompiler. Look for ANSI compliancy, I don't have the Pro*C documentation on hand right now, but look for ANSI and Oracle7 settings. Eg. ANSI and non-ANSI in Pro*C are very different when it comes to truncating strings, padding spaces, VARCHAR vs CHAR, cursors and so on.

BTW, I think using typedef just confuses the code.

Johan Thorselius

kyutae lim wrote:

> hi , there.
>
> I have a big problem in pro*c program.
> this is sample program and table layout.
> I found ora-1400 error.
> hw can I insert '1 byte space charactor' in not null column?
> -----------------------------------------------------
> exec sql include sqlca.h;
> typedef char char1;
> EXEC SQL TYPE char1 IS char(1);
> static char1 sql_dr_acc_type;
> main()
> {
> char username[10], password[10];
>
> strcpy(username, "SCOTT");
> strcpy(password, "TIGER");
> exec sql connect :username identified by :password;
> sql_dr_acc_type = ' ';
> exec sql insert into a (b) values (:sql_dr_acc_type);
> printf("code :%c:%d:\n", sql_dr_acc_type,sqlca.sqlcode);
> exec sql commit;
> }
> --------------------------------------------------------
> table layout
> table a (b char(1) not null)
> ^^^^^^


Received on Tue Jan 05 1999 - 08:00:31 CST

Original text of this message

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