Win a copy of Design for the Mind this week in the Design forum!
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic

Oracle PL / SQL Drop Table Exception Handling

 
Joe Harry
Ranch Hand
Posts: 10106
3
Eclipse IDE Mac PPC Ubuntu
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
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.
 
Joe Harry
Ranch Hand
Posts: 10106
3
Eclipse IDE Mac PPC Ubuntu
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
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
Posts: 423
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Hi,

use nested begin-exception-end blocks to handle exceptions in PL/SQL
 
Avi Abrami
Ranch Hand
Posts: 1141
1
Java Oracle
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator

 
Joe Harry
Ranch Hand
Posts: 10106
3
Eclipse IDE Mac PPC Ubuntu
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Thanks guys!
 
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic