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

wht is d/f between union and joins ?

2 Answers  


What is reorg in database?

1 Answers  


What is a system catalog table in db2?

0 Answers  


Is it Possible to read from PS file and write it to database by using dynamic sql(execute immediate)

2 Answers  


Is db2 free?

0 Answers  






What are the different methods of accessing db2 from tso? How is the connection established between TSO & DB2?

3 Answers   Tech Mahindra,


what is db2 restart?

0 Answers  


How to resolve the -305 error code in DB2? And also please let me know, how to resolve the db2 error codes.

7 Answers   TCS,


cobol-db2 runjcl please?

2 Answers   DELL,


I am having n number of records in a table which consists of emp-name is one of the field among them. Now i want to change the first letter of every name with capital.

1 Answers   Cap Gemini,


I have some 3 particular fields ..i want to know which all tables have those 3 fields. Is there any way to identify.. can we know by quering system tables..

5 Answers   CTS,


What should be specified along with a cursor in order to continue updating process after commit?

1 Answers   IBM,


Categories