Problem--Dynamic SQL method 4 using host array [message #153988] |
Thu, 05 January 2006 04:40 |
lls_study
Messages: 3 Registered: January 2006
|
Junior Member |
|
|
Statment:
char *sql_stmt =
"INSERT INTO emp (empno) VALUES (:e)"; // empno's type is int
char empno[ARRAY_SIZE][4];
array_size = ARRAY_SIZE;
assignment:
binda->V[0] = (char *) empno;
binda->L[0] = (long) 4;
binda->T[0] = 1;
binda->I[0] = (short *)0;
/* Initialize the data buffers. */
strcpy(&empno[0] [0], "100");
empno[0][3] = -51;
strcpy(&empno[1] [0], "100");
empno[1][3] = -51;
Execute:
EXEC SQL FOR :array_size
EXECUTE stmt USING DESCRIPTOR binda;
Then it can insert two rows to emp
but if using empno[0][3] = '\0';
it displayed error: ORA-01722:invalid number
Why?
Can anyone help me?
|
|
|
|