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

Write a query to retrive partial string.

2 Answers  


What is the use of reorg in db2?

0 Answers  


Normalization in DB2 – first normal form, second normal form

4 Answers   Virtusa,


Cursors can be declared in both working-storage & procedure division, Agreed. But is there any difference? If could you please suggest what is the difference. TIA

8 Answers   CGI, Wipro,


In which column of which DB2 catalog would you find the length of the rows for all tables?

2 Answers  


db2 query I have one table with the following details. SNO SNAME DOJ ------ -------------------- ---------- 10 KRISH 2007-03-19 20 REDDY 2007-05-19 30 RRRRR 2007-05-19 40 BBBBB 2008-05-19 50 CCCCC 2009-05-19 60 JJJJJ 2009-05-19 70 JJJJJ 2004-05-19 i want the output in the following format:( no of students joined in each year(no nedd to consider about month and date) year count --------- ---------- 2004 1 2007 3 2008 1 2009 2

9 Answers   TCS,


DB2 is a A) data base/data communication system B) data base C) RDBMS D) Programming language

4 Answers   Accenture,


How do you retrieve the first 5 characters of firstname column of db2 table emp?

1 Answers  


Explain about dbrm.

0 Answers  


What is a clustered index?

1 Answers  


What is null value in db2?

0 Answers  


In BIND, isolation level parameter specifies the duration of page lock and ACQUIRE, RELEASE also do almost the same thing. What is the exact difference between the two? Do they work in conjunction while executing SQL queries and obtaining locks?

8 Answers   Syntel,


Categories