• Post Reply Bookmark Topic Watch Topic
  • New Topic
programming forums Java Mobile Certification Databases Caching Books Engineering Micro Controllers OS Languages Paradigms IDEs Build Tools Frameworks Application Servers Open Source This Site Careers Other Pie Elite all forums
this forum made possible by our volunteer staff, including ...
Marshals:
  • Campbell Ritchie
  • Jeanne Boyarsky
  • Ron McLeod
  • Paul Clapham
  • Liutauras Vilda
Sheriffs:
  • paul wheaton
  • Rob Spoor
  • Devaka Cooray
Saloon Keepers:
  • Stephan van Hulst
  • Tim Holloway
  • Carey Brown
  • Frits Walraven
  • Tim Moores
Bartenders:
  • Mikalai Zaikin

BatchUpdateException .UpdateCounts

 
Greenhorn
Posts: 27
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Hi,
I am doing some batch deletion.
When i am deleting some records from a particular table,if there
are any child records found for a particular statement
in the batch ,will the oracle thin driver
proceed with the rest of the statements in the batch ?
Currently ,i dont think it is doing so.
I used the batchupdateexception.getUpdateCounts and checked for value of -3
(which means statement failed) in the array.
after the non successful record,
it is giving -3 for the statements which dont have child records and
should be deleted.Is there any work around for this ?
In my batch operation,i must be able to identify only those deletions (of records)
which violate the referential constraint for the child record.
I cant do this in a seperate select query.
Can somebody pls help ?

Thanks
Naveen.N
 
Ranch Hand
Posts: 382
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator

Originally posted by N Naveen:
Hi,
I am doing some batch deletion.
When i am deleting some records from a particular table,if there
are any child records found for a particular statement
in the batch ,will the oracle thin driver
proceed with the rest of the statements in the batch ?
Currently ,i dont think it is doing so.
I used the batchupdateexception.getUpdateCounts and checked for value of -3
(which means statement failed) in the array.
after the non successful record,
it is giving -3 for the statements which dont have child records and
should be deleted.Is there any work around for this ?
In my batch operation,i must be able to identify only those deletions (of records)
which violate the referential constraint for the child record.
I cant do this in a seperate select query.
Can somebody pls help ?

Thanks
Naveen.N


Naveen, I'm not quite sure what you are trying to do. Do you want to delete those rows in parent that don't have any child rows? If so, you can write your delete statement with the where clause of something like the following:
delete parent table where <yr conditions> and not exists (select 1 from child table where child.keys = parent.keys).
 
N Naveen
Greenhorn
Posts: 27
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
my purpose is not to delete only those records which dont have child records.
On my screen,i have a set of values which the user may delete.
these values present in x table may or may not have child records in either y or z table.
while trying to delete using batch update,i must be able to identify those values which are giving error /referential constraint error.
 
reply
    Bookmark Topic Watch Topic
  • New Topic