In db2, how do you insert multiple rows in 1 query using a.)
Cursors, b.) Normal query?? Give syntax for both.

Answers were Sorted based on User's Feedback



In db2, how do you insert multiple rows in 1 query using a.) Cursors, b.) Normal query?? Give synta..

Answer / vaibhav

We can insert by using the following command:-

Insert into tablename
(col1,col2,col3,....)
values(&emp-no, '&emp-name', .....)

Is This Answer Correct ?    7 Yes 5 No

In db2, how do you insert multiple rows in 1 query using a.) Cursors, b.) Normal query?? Give synta..

Answer / adi

MOVE +100 TO HV-NUM-ROWS.
INSERT INTO EMP
(EMPNO, LASTNAME, FIRSTNME,
MIDINIT, SALARY, BONUS)
VALUES (:HV-EMPNO-ARRAY,
:HV-LASTNAME-ARRAY,
:HV-SALARY-ARRAY,
:HV-BONUS-ARRAY)
FOR :HV-NUM-ROWS
ATOMIC

all array elements will have a 100 occur clause

Is This Answer Correct ?    1 Yes 0 No

In db2, how do you insert multiple rows in 1 query using a.) Cursors, b.) Normal query?? Give synta..

Answer / uma

We can't insert multiple row in single query for the we
have to use cursor.

Is This Answer Correct ?    5 Yes 5 No

In db2, how do you insert multiple rows in 1 query using a.) Cursors, b.) Normal query?? Give synta..

Answer / shekhar

insert into table1
select * from table2
where cond

this query will insert multiple rows at once.

there is load utility of DB2 can help in inserting bulk data from data file.

Plz correct me if i m wrong.

Is This Answer Correct ?    2 Yes 2 No

In db2, how do you insert multiple rows in 1 query using a.) Cursors, b.) Normal query?? Give synta..

Answer / siri

insert into tableName
(col1, col2, col3, col4, col5)
values
(val1, val2, val3, val4, val5),
(val1, val2, val3, val4, val5),
(val1, val2, val3, val4, val5),
(val1, val2, val3, val4, val5);

Is This Answer Correct ?    4 Yes 5 No

Post New Answer

More DB2 Interview Questions

What is the purpose of coding FETCH in a SQL SELECT query? Explain with an example in Detail?

4 Answers  


1) I have 3 programs : PGMA, PGMB, PGMC. PGMA calls PGMB and PGMB calls PGMC. I have to do inserts, updates in all the 3 pgms. 2) Say PGMC has done its work successfully and returned to PGMB 3) PGMB had an SQL error while doing some update 4) PGMA has already done some updates before calling PGMB all are running under the same CICS region. What will happen if I issue SYNCPOINT ROLLBACK in PGMB when it abends ? Does all the changes in PGMA,B,C rollback ? (because all the pgms belong to same task).

1 Answers  


what is copy pending and check pending ?

1 Answers   Xansa,


How to execute stored procedure in db2 command editor?

0 Answers  


What is difference between *omit and *nopass?

1 Answers   IBM, TCS,






What types of tables are there in the db2 database?

0 Answers  


How will you return the number of records in table?

0 Answers  


What are the functions in DB2?

3 Answers   Satyam,


Can i insert bulk records into a db2 table using qmf of spufi only............!!!

2 Answers  


When the like statement is used?

0 Answers  


How to solved 818 error

4 Answers   Keane India Ltd, Wipro,


by using cursors , we can access particular records from the table based on some condition, i want to delete those selected records, how can we write a query for this in the program?

4 Answers   Mphasis,


Categories