在Oracle中的一个ExecuteScalar中运行多个命令 [英] Run multiple commands in one ExecuteScalar in Oracle

查看:104
本文介绍了在Oracle中的一个ExecuteScalar中运行多个命令的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我有一批sql语句,例如...

I have a batch of sql statements such as ...

插入.... 插入.... ; 删除.........;

insert into.... ; insert into.... ; delete .........;

当我尝试针对oracle执行它们时,它给了我错误(ORA- 00911无效字符)

When i try to execute them against oracle it gives me this error (ORA-00911 Invalid Character)

现在我可以理解,这是由于语句之间的分号所致,我在SQL Server上尝试了此操作,但仍有效,但到目前为止在Oracle中还算不上运气.

now i can understand that this is because of the semicolon between the statements, i tried this on SQL Server and it worked but in Oracle no luck so far.

是否有一种方法可以通过使用ExecuteScalar或其他函数针对oracle运行多个语句?

Is there a way to run multiple statements against oracle by using the ExecuteScalar or some other function?

重复:如何使用.NET执行多个Oracle SQL语句

推荐答案

尝试使用BEGIN..END

BEGIN insert into.... ; insert into.... ; delete .........; END;

这篇关于在Oracle中的一个ExecuteScalar中运行多个命令的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆