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
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 |
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 |
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 |
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 |
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 |
What is the purpose of coding FETCH in a SQL SELECT query? Explain with an example in Detail?
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).
what is copy pending and check pending ?
How to execute stored procedure in db2 command editor?
What is difference between *omit and *nopass?
What types of tables are there in the db2 database?
How will you return the number of records in table?
What are the functions in DB2?
Can i insert bulk records into a db2 table using qmf of spufi only............!!!
When the like statement is used?
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?