Everything looks OK, but...
Posted in 1999
Topics: Error Codes & Troubleshooting
Hi All I have a strange problem. I run a program, which call db function. This function should inser some information to tha table. sqlca.sqlcode returns "0", but there is no changes in the table. Here the code : #include <string.h> #include "gl_common.h" #include "db_common.h" #include <stdio.h> EXEC SQL INCLUDE sqlca; db_00_ins_bctemp(barcode) EXEC SQL BEGIN DECLARE SECTION; char *barcode; EXEC SQL END DECLARE SECTION; { int ret_value; ENTER_PROC("db_00_ins_bctemp"); db_prepare(DB_MODIFY); EXEC SQL INSERT INTO bc_temp VALUES (1,:barcode); ret_value = db_status(DB_MODIFY); RET(ret_value); } Regards Igor
How about declaring the host variable as follows (instead of as a pointer to char): EXEC SQL BEGIN DECLARE SECTION; char barcode[n+1]; EXEC SQL END DECLARE SECTION; n = size of the column in the table Hal Igor wrote in message <37b439e8.174191336@news.ca.geac.com>... >Hi All > >I have a strange problem. I run a program, which call db function. >This function should inser some information to tha table. >sqlca.sqlcode returns "0", but there is no changes in the table. >Here the code : > > #include <string.h> >#include "gl_common.h" >#include "db_common.h" >#include <stdio.h> > > >EXEC SQL INCLUDE sqlca; > > >db_00_ins_bctemp(barcode) > EXEC SQL BEGIN DECLARE SECTION; > char *barcode; > EXEC SQL END DECLARE SECTION; >{ > int ret_value; > > ENTER_PROC("db_00_ins_bctemp"); > > db_prepare(DB_MODIFY); > > EXEC SQL INSERT INTO bc_temp > VALUES (1,:barcode); > > ret_value = db_status(DB_MODIFY); > > > RET(ret_value); >} > >Regards > > >Igor