• 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
  • Ron McLeod
  • Paul Clapham
  • Devaka Cooray
  • Liutauras Vilda
Sheriffs:
  • Jeanne Boyarsky
  • paul wheaton
  • Henry Wong
Saloon Keepers:
  • Stephan van Hulst
  • Tim Holloway
  • Tim Moores
  • Carey Brown
  • Mikalai Zaikin
Bartenders:
  • Lou Hamers
  • Piet Souris
  • Frits Walraven

particular SQLCODE bypass in batch mode

 
Greenhorn
Posts: 2
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Hi,

I am running a java application in batch mode by reading records from a oracle table and if a matching row found in another table insert a record into 3rd table. While inserting record if I get sqlcode -803 ( duplicate row ) I would not want to stop the process because of sql exception. I want to skip this row and continue processing the next row .

Could anyone tell me how I can code this , please.

Thanks
karshyam
 
author & internet detective
Posts: 41967
911
Eclipse IDE VI Editor Java
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Karshyam,
Welcome to JavaRanch!

In JDBC, each transaction is commited to the database by default. So you can just catch the exception and move on to the next record.
 
karshyam chandran
Greenhorn
Posts: 2
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Thanks for your response.

I am trying to find out, is there a way to tell that if a sqlexception with a particular sql code happens donot catch the exception and continue processing as such it is OK to have that exception.

The only way to control this is by coding the logic in catch block I can do it. Before that I wanted to make sure , Is that the correct solution.

Any thoughts , please share it.

Thanks..
 
Jeanne Boyarsky
author & internet detective
Posts: 41967
911
Eclipse IDE VI Editor Java
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Karshyam,
Yes, you need to code logic in the catch block. The pattern for this is:
 
Then YOU must do the pig's work! Read this tiny ad. READ IT!
We need your help - Coderanch server fundraiser
https://coderanch.com/wiki/782867/Coderanch-server-fundraiser
reply
    Bookmark Topic Watch Topic
  • New Topic