View previous topic :: View next topic |
Author |
Message |
madan777in Beginner
Joined: 07 Dec 2005 Posts: 12 Topics: 6
|
Posted: Mon Aug 20, 2007 6:42 am Post subject: GET DIAGNOSTICS insert |
|
|
Hi ,
Could you please provide some example code or functionality to insert multiple rows into Table using Insert Arrays , Atomic function .
I want to load the table be correcttly calculated prior to the insert.when researched i came across get diagonistic function . But iam unclear with example provided .
Thanks |
|
Back to top |
|
 |
kolusu Site Admin

Joined: 26 Nov 2002 Posts: 12378 Topics: 75 Location: San Jose
|
|
Back to top |
|
 |
madan777in Beginner
Joined: 07 Dec 2005 Posts: 12 Topics: 6
|
Posted: Mon Aug 20, 2007 8:21 am Post subject: |
|
|
Thanks Kolusu |
|
Back to top |
|
 |
madan777in Beginner
Joined: 07 Dec 2005 Posts: 12 Topics: 6
|
Posted: Mon Aug 27, 2007 6:57 am Post subject: |
|
|
Koulsu, Thanks for your reply .. But I have problem in issuing this multiple insert querry n Spufi or Qmf . Iam end up with -803 (duplicate data )
For eg i used the query like
INSERT IN TABLE (C1,C2) VALUES ('123','TEST') FOR 2 ROWS;
SQLCODE = -803, ERROR: AN INSERTED OR UPDATED VALUE IS INVALID
BECAUSE INDEX IN INDEX SPACE IRPARF01 CONSTRAINS COLUMNS OF THE TABLE
SO NO TWO ROWS CAN CONTAIN DUPLICATE VALUES IN THOSE COLUMNS.
Please let me know how to check the Multiple insert querry in Spufi or Qmf .. Below is the querry given in IBM link
EXEC SQL INSERT INTO T1 FOR :hv ROWS VALUES (:hva:hvind) ATOMIC; |
|
Back to top |
|
 |
kolusu Site Admin

Joined: 26 Nov 2002 Posts: 12378 Topics: 75 Location: San Jose
|
Posted: Mon Aug 27, 2007 7:07 am Post subject: |
|
|
Quote: |
SQLCODE = -803, ERROR: AN INSERTED OR UPDATED VALUE IS INVALID
|
madan777in,
The error is self explantory. You have an index defined which does NOT allow duplicates. And that is the reason as to why you got a sql code of -803. If you want dups to be inserted then drop the index.
Kolusu _________________ Kolusu
www.linkedin.com/in/kolusu |
|
Back to top |
|
 |
madan777in Beginner
Joined: 07 Dec 2005 Posts: 12 Topics: 6
|
Posted: Mon Aug 27, 2007 7:17 am Post subject: |
|
|
Yes - 803 is the reason for duplicate data inserted twice . but in real time thru program we wont get data has duplicate . Dupicate data was handled .
Please let me know(any eg) how this querry can be checked in qmf for 3 rows without any duplicate data .
EXEC SQL INSERT INTO T1 FOR :hv ROWS VALUES (:hva:hvind) ATOMIC;
Thanks , |
|
Back to top |
|
 |
kolusu Site Admin

Joined: 26 Nov 2002 Posts: 12378 Topics: 75 Location: San Jose
|
Posted: Mon Aug 27, 2007 7:56 am Post subject: |
|
|
Quote: |
Please let me know(any eg) how this querry can be checked in qmf for 3 rows without any duplicate data .
EXEC SQL INSERT INTO T1 FOR :hv ROWS VALUES (:hva:hvind) ATOMIC;
|
madan777in,
QMF/SPUFI does NOT support host-variable array processing. If you really want to insert multiple rows then create a temp table and insert all the values in it and use that to insert rows in to the main table
Code: |
INSERT INTO table
SELECT *
FROM temp table FETCH FIRST 3 rows only;
|
Kolusu _________________ Kolusu
www.linkedin.com/in/kolusu |
|
Back to top |
|
 |
madan777in Beginner
Joined: 07 Dec 2005 Posts: 12 Topics: 6
|
Posted: Mon Aug 27, 2007 8:18 am Post subject: |
|
|
Thanks Kolusu .. Now iam Clear with your reply .. |
|
Back to top |
|
 |
|
|