Home » RDBMS Server » Server Utilities » Pro*c array insert
Pro*c array insert [message #69127] Sun, 04 November 2001 18:27 Go to next message
Bala Subramanian
Messages: 1
Registered: November 2001
Junior Member
Hi
In Pro*c, I tried to insert bulk records at one go using the below concept.

int emp_number[[50]];
char name[[50]][[11]];
/* ... */
EXEC SQL FETCH ......
EXEC SQL INSERT INTO emp_det(emp_number, name)
VALUES (:emp_number, :emp_name);

this will insert all the 50 tuples in one go.

but my source table has only 30 tuples at present,when tried to use the above concept 50 tuples are inserted including 20 blank rows.

pls suggest me how to avoid those blank rows.


----------------------------------------------------------------------
Re: Pro*c array insert [message #69137 is a reply to message #69127] Tue, 06 November 2001 07:31 Go to previous message
Somu
Messages: 24
Registered: February 2000
Junior Member
Hi,

If you insert the array as it is, it will insert all the records into the table, instead of that you can use the following.

EXEC SQL FOR :no_of_rec INSERT INTO emp_det(emp_number, name)
VALUES (:emp_number, :emp_name);

but, you have to declare a variable and assign the fetched record into the variable and use the above code.

Regards
somu

----------------------------------------------------------------------
Previous Topic: To know details of your activities and on ORACLE U provide
Next Topic: Export excel data to oracle
Goto Forum:
  


Current Time: Tue Apr 16 09:04:01 CDT 2024