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 difference between base table and view?

7 Answers  


What is cloudant database?

0 Answers  


Explain various types of locks in db2?

0 Answers  


Is it possible to alter a table – for example adding a column, when another user is accessing or updating some columns?

0 Answers  


If the base table underlying a view is restructured, eg. attributes are added, does the application code accessing the view need to be redone?

2 Answers  






what is the sqlcode -501

5 Answers   IBM, Polaris, Zeus,


How does db2 sample database connect?

0 Answers  


What is db2 command?

0 Answers  


How to check sequence on a table in db2?

0 Answers  


I HAVE 2 TABLES ONE IS EMP_TABLE AND ANOTHER DEPT_TABLE.EMP_TABLE CONTAINS NAME,DEPTNO,DEPTNAME,LOCATION AND DEPT_TABLE CONTAINS DEPTNO,DOJ(DATE OF JOINING).I WANT TO DISPLAY NAME,DEPTNAME,DOJ AND WHO ARE JOINED BETWEN 01- JAN-2007 TO 01-JAN-2008?

6 Answers   Perot Systems,


What is the role of the data page in the db2 database?

0 Answers  


What are sqlcodes –803,-805, -811, -818,-904,-911,-913,-101, +100?

0 Answers  


Categories