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: Douglas Whitacre <whitacre_at_imake.com>
Date: Tue, 5 Jan 1999 11:26:02 -0500
Message-ID: <76teeu$hek@world1.bellatlantic.net>


What you need to do is throw an NVL around the variable:

>> exec sql insert into a (b) values (NVL(:sql_dr_acc_type, ' ' ));

(there is a space between the two single quotes)

>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 - 10:26:02 CST

Original text of this message

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