A friendly place for programming greenhorns!
Big Moose Saloon
Register / Login
Win a copy of
video training course this week in the
JDBC and Relational Databases
DB2: Using NOT EXISTS with SYSIBM.DUAL in a complex batch query
Joined: Nov 27, 2008
Sep 05, 2011 04:55:47
I have data in a
object as data1, data2.
data1 and data2 together forms a composite key in myTable where I want to insert the object.
The writing is happening as a batch. Like 10 insert statements are prepared using 10 objects and are executed as a batch.
I want to insert the above data with the constraint: data1 + data2 should not already be present in myTable i.e. data1 + data2 should be unique --- if unique then write else just ignore.
The query I am using is:
Insert into mySchema.myTable(column1, column2) select 'abc', '123' from SYSIBM.DUAL where not exists (select 1 from mySchema.myTable A where 'abc' = A.column1 and '123' = A.column2)
Running above query independently for single set of data runs successfully.
However, while running in batch scenario I am getting "com.ibm.db2.jcc.b.ie: Non-atomic batch failure." error.
I think it has something to do with using SYSIBM.DUAL in batch scenario.
I agree. Here's the link:
subject: DB2: Using NOT EXISTS with SYSIBM.DUAL in a complex batch query
series of updates
how do i make a field mandatory in my WSDL using axis2
How do I assign variables with values from a list?
Which collection to use?
Concatenating string texts based of key value
All times are in JavaRanch time: GMT-6 in summer, GMT-7 in winter
| Powered by
Copyright © 1998-2015