Home » Developer & Programmer » Precompilers, OCI & OCCI » Problem--Dynamic SQL method 4 using host array
Problem--Dynamic SQL method 4 using host array [message #153988] Thu, 05 January 2006 04:40 Go to next message
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?
Re: Problem--Dynamic SQL method 4 using host array [message #154215 is a reply to message #153988] Fri, 06 January 2006 04:47 Go to previous message
Maaher
Messages: 7062
Registered: December 2001
Senior Member
Because it is not a valid number. Isn't \0 a special character in C environments? What does it stand for?

MHE
Previous Topic: signal SEGV (no mapping at the fault address) in sqllkc
Next Topic: PCB-S-00209, Scale is not supported for host variable "Sum"
Goto Forum:
  


Current Time: Mon Oct 26 23:16:41 CDT 2020