Oracle批量执行SQL语句

SQLServer的场合,用";"分割SQL语句即可正常执行。

Oracle的场合,会报ORA-00911错误。Oracle中需要加上begin end才正确。

            Dim Sql As String = ""
            Sql = Sql & " BEGIN "
            Sql = Sql & vbCrLf
            Sql = Sql & " insert into tableA (col1,col2,col3) values ('a','a','a');"
            Sql = Sql & vbCrLf
            Sql = Sql & " insert into tableA (col1,col2,col3) values ('b','b','b');"
            Sql = Sql & vbCrLf
            Sql = Sql & " END; "

            Dim comd As New OleDbCommand(Sql, DbConn)
            comd.ExecuteNonQuery()

原文地址:https://www.cnblogs.com/sekihin/p/3340147.html
Creative Commons License 本作品采用 知识共享署名-非商业性使用 2.5 中国大陆许可协议进行许可。