更新 Oracle 包中的单个过程

声明:本页面是StackOverFlow热门问题的中英对照翻译,遵循CC BY-SA 4.0协议,如果您需要使用它,必须同样遵循CC BY-SA许可,注明原文地址和作者信息,同时你必须将它归于原作者(不是我):StackOverFlow 原文地址: http://stackoverflow.com/questions/2201643/
Warning: these are provided under cc-by-sa 4.0 license. You are free to use/share it, But you must attribute it to the original authors (not me): StackOverFlow

提示:将鼠标放在中文语句上可以显示对应的英文。显示中英文
时间:2020-09-18 19:57:27  来源:igfitidea点击:

Updating an individual procedure in an Oracle package

oracleplsqloracle10g

提问by wadesworld

Using Oracle 10g.

使用 Oracle 10g。

I'm writing a script to apply the delta changes made on our development system to our stage system.

我正在编写一个脚本,将在我们的开发系统上所做的增量更改应用到我们的舞台系统。

Is there a way to modify or insert an individual procedure within a package without including the entire package contents in my script? I think the answer is no, but I wanted to be sure because it's going to be pretty ugly to have to include the entire contents of any modified packages when the changes were small.

有没有办法在我的脚本中不包含整个包内容的情况下修改或插入包中的单个过程?我认为答案是否定的,但我想确定,因为当更改很小时必须包含任何修改包的全部内容会非常难看。

采纳答案by APC

Sorry but your gut instinct is correct. The unit of change is the PACKAGE BODY.

抱歉,您的直觉是正确的。变化的单位是 PACKAGE BODY。

Not sure why you think it's ugly though. surely it's just a matter of calling a script for the package?

不知道为什么你认为它很丑。当然这只是为包调用脚本的问题?

回答by Tony Andrews

No, a package body must be replaced as a whole. Rather than include the code for several packages in a single script, I would create a file per package spec and a file per package body. You can then write a "meta-script" to run the required package changes in SQL Plus:

不可以,必须整体更换包体。我不会在单个脚本中包含多个包的代码,而是为每个包规范创建一个文件,并为每个包主体创建一个文件。然后,您可以编写一个“元脚本”来运行 SQL Plus 中所需的包更改:

@@package1.spc
@@package1.bdy
@@package2.bdy

回答by Ev.Rei.

Faced same problem. Simply created separate package for a procedure that changes frequently.

面临同样的问题。只需为经常更改的程序创建单独的包。