C#中利用Oracle事务删除表

在编写程序时,有进需要利用orcale事务删除数据库中的表,
这时,像我这样的初学者会比较容易犯一个错误,就是把事务写成如下样式:

1 begin  
2 drop   table  tableName;
3 OtherSQlSentense
4 commit ;
5 end ;
这样就会报错。这时,只要把事务改成如下样式就行了 :
1 begin
2 execute  immediate  ' drop table tableName ' ;
3 otherSQLSentence;
4 commit ;
5 end ;

你可能感兴趣的:(oracle)