View Single Post
Old 06-15-2005, 07:40 AM   #1 (permalink)
leialeia
Registered User
 
Join Date: Jun 2005
Posts: 2
leialeia is on a distinguished road
passing array to embedded sql

I'd like to know if it's possible to insert multiple records with a single query. The values comes from an array of values.

let say, i have two arrays:
NAME[10]
AGE[10]

how do i loop 10 times to ADD the values to a DB2 table named TABLE2?

i have a code on how to add a single NAME & AGE.
SUBMIT SQL CONTINUE;
CONNECT TO DB2(SSID=&DB2ID);
EXECUTE(INSERT INTO &CREATOR.&TABLE2 (NAME, AGE)
VALUES('&NAME','&AGE')) BY DB2;
%PUT SQLXRC=&SQLXRC, SQLXMSG=&SQLXMSG;
%LET SQLDBRC=&SYSDBRC;
EXECUTE(COMMIT) BY DB2;
DISCONNECT FROM DB2;
QUIT;
ENDSUBMIT;

thanks!
leialeia is offline   Reply With Quote