This week's giveaway is in the Android forum.
We're giving away four copies of Android Security Essentials Live Lessons and have Godfrey Nolan on-line!
See this thread for details.
The moose likes Oracle/OAS and the fly likes Oracle PL / SQL Drop Table Exception Handling Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login


Win a copy of Android Security Essentials Live Lessons this week in the Android forum!
JavaRanch » Java Forums » Products » Oracle/OAS
Bookmark "Oracle PL / SQL Drop Table Exception Handling" Watch "Oracle PL / SQL Drop Table Exception Handling" New topic
Author

Oracle PL / SQL Drop Table Exception Handling

Joe Harry
Ranch Hand

Joined: Sep 26, 2006
Posts: 9345
    
    2

Guys,

I would like to handle exceptions using PL SQL for the drop able and create table scripts. This would happen when I initially set up the db scripts, I would have a drop table statement preceeding the create table statement. But when the script is being run for the first time, the drop table would result in an error and I would like to handle this error and proceed with the create table. Any suggestions or pointers on how to do this.


SCJP 1.4, SCWCD 1.4 - Hints for you, Certified Scrum Master
Did a rm -R / to find out that I lost my entire Linux installation!
Joe Harry
Ranch Hand

Joined: Sep 26, 2006
Posts: 9345
    
    2

Found out a way to do this. Wrote a Procedure that would take a varchar as parameter and check if this parameter is a table and if yes, it will drop the table and if the table does not exist, the thrown exception will be handled properly and the procedure returns.
Ireneusz Kordal
Ranch Hand

Joined: Jun 21, 2008
Posts: 423
Hi,

use nested begin-exception-end blocks to handle exceptions in PL/SQL
Avi Abrami
Ranch Hand

Joined: Oct 11, 2000
Posts: 1121


Joe Harry
Ranch Hand

Joined: Sep 26, 2006
Posts: 9345
    
    2

Thanks guys!
 
I agree. Here's the link: http://aspose.com/file-tools
 
subject: Oracle PL / SQL Drop Table Exception Handling
 
Similar Threads
Use PL/SQL Loop and variable
PL/SQL PLS-00905 Object is invalid error
Dukes bank problem with database creation on JBoss
getting the last inserted value
Drop tables recursively