IMZRH的日志

努力成为一个有用的人

导航

C#中利用Oracle事务删除表

Posted on 2007-07-08 10:08  张荣华  阅读(964)  评论(0编辑  收藏  举报

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

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