我如何可以执行多个Oracle SQL语句与.NET [英] How can I execute multiple Oracle SQL statements with .NET

查看:102
本文介绍了我如何可以执行多个Oracle SQL语句与.NET的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

由于我们的构建过程中,我们要执行的SQL脚本包括DDL和DML对一个新的数据库实例声明的一部分。

As a part of our build process we want to execute SQL Scripts consisting of DDL and DML statements against a fresh database instance.

ADO.NET连接/命令不能没有解析和分裂的脚本处理这个问题。

ADO.NET Connection/Command can't handle this without parsing and splitting the scripts.

sqlplus中命令行实用程序可以执行脚本只能交互,并且不适合批量使用。

The sqlplus command line utility can execute scripts only interactively, and isn't suited for batch usage.

我在想什么?使用Oracle当一个人如何可以执行SQL脚本?

What am I missing? How can one execute sql scripts when using oracle?

推荐答案

为什么你认为SQL * Plus实用程序不适合批量使用情况如何?这是常见的用它来运行这类scripts--你可以通过脚本来SQL * pretty的加当你调用它,如果你愿意,也就是

Why do you believe that the SQL*Plus utility isn't suited for batch usage? It's pretty common to use it for running these sorts of scripts-- you can pass the script to SQL*Plus when you invoke it if you'd like, i.e.

sqlplus scott/tiger@someDatabase @someScript.sql

这是部署的pretty的常见方式的基础之上。

That is a pretty common way of deploying builds.

如果该问题是与SQL * Plus的被处理错误,你可以简单地添加行

If the problem is with the way SQL*Plus is handling errors, you can simply add the line

WHENEVER SQLERROR EXIT SQL.SQLCODE

中止并抛出所遇到的Oracle错误号。本文档中的 WHENEVER SQLERROR命令提供了许多其他的选项,以及

to abort and throw the Oracle error number that was encountered. The documentation for the WHENEVER SQLERROR command provides a number of other options as well.

这篇关于我如何可以执行多个Oracle SQL语句与.NET的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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