• 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:
  • Tim Cooke
  • Campbell Ritchie
  • Jeanne Boyarsky
  • Ron McLeod
  • Liutauras Vilda
Sheriffs:
  • Rob Spoor
  • Junilu Lacar
  • paul wheaton
Saloon Keepers:
  • Stephan van Hulst
  • Tim Moores
  • Tim Holloway
  • Carey Brown
  • Scott Selikoff
Bartenders:
  • Piet Souris
  • Jj Roberts
  • fred rosenberger

How to catch Oracle error codes and error message

 
Ranch Hand
Posts: 197
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Hi All,
I am trying to run oracle procedure/Function using Hibernate 3. I want to catch error raised by oracle procedure/Function and display error message to user.

By using this code I can able to run only procedures and If any error occured in procedure my control is going to SQLException block. I want to check the error message.
Please check this code and let me know is this correct way to call procedure??
Please share document related to calling procedure from hibernate.

Thanks.
 
Ranch Hand
Posts: 44
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
This is the right way you call stored proc from hibernate.
Are you not getting error code in SQLException object? What exactly is your requirement?

Thanks
HK
 
Reshma Reddy
Ranch Hand
Posts: 197
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Hi Kilal,
I'm getting error code in SQLException block, but i want to get error codes in execute statement only.
and what about if function will return some object??
 
hildich kilal
Ranch Hand
Posts: 44
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
You can handle exception in Stored procedure (in EXCEPTION block) assign the error code and error message to two variables. Set these variables as OUT parameters in your stored procedure.

Read them after execute. This way SQLException will not be thrown.

Hope this helps.
HK
 
Consider Paul's rocket mass heater.
reply
    Bookmark Topic Watch Topic
  • New Topic