oracle 从 SQLPLUS 更新包
声明:本页面是StackOverFlow热门问题的中英对照翻译,遵循CC BY-SA 4.0协议,如果您需要使用它,必须同样遵循CC BY-SA许可,注明原文地址和作者信息,同时你必须将它归于原作者(不是我):StackOverFlow
原文地址: http://stackoverflow.com/questions/4431418/
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
Update a package from SQLPLUS
提问by H. Abraham Chavez
I'm trying to update a package in Oracle, coming from SQL Server this has been confusing.
我正在尝试更新 Oracle 中的一个包,来自 SQL Server 这一直令人困惑。
I have written a batch file that runs the .specfile first and the .bodyfile second, but even running it manually does not work.
我编写了一个批处理文件,它首先运行.spec文件,然后运行.body文件,但即使手动运行它也不起作用。
I use this syntax:
我使用这个语法:
sqlplus username/password@databasename @c:\temp\myfile.spec
sqlplus username/password@databasename @c:\temp\myfile.body
When I go back to Sql Developer I can look at the stored procedures in the package and see that they have not been updated.
当我回到 Sql Developer 时,我可以查看包中的存储过程,发现它们尚未更新。
Why aren't my packages getting updated?
为什么我的软件包没有更新?
回答by Sathyajith Bhat
The spec and body files need to have /
make SQL*Plus create/replace the object.
规范和正文文件需要/
使 SQL*Plus 创建/替换对象。
Without the /
:
没有/
:
CREATE OR REPLACE PACKAGE TEST12_13 AS
PROCEDURE TEST12_13;
END;
STAGE@DB>@C:\TEST.PKS
6
With the /
:
随着/
:
CREATE OR REPLACE PACKAGE TEST12_13 AS
PROCEDURE TEST12_13;
END;
/
STAGE@DB>@C:\TEST.PKS
Package created.
In reply to your comment about passing filename as parameter, instead of passing the filename as parameter, have SQL*Plus ask you for the filename
回复您关于将文件名作为参数传递的评论,而不是将文件名作为参数传递,让 SQL*Plus 询问您的文件名
wrapper.sql
ACCEPT filename_var Prompt 'Enter filename'
@c:\temp\&filename_var
/
@c:\temp\&filename_var
/
回答by Sathyajith Bhat
Connect to SQL*Plus with
连接到 SQL*Plus
sqlplus username/password@databasename
Then run the script from the SQL*Plus prompt:
然后从 SQL*Plus 提示符运行脚本:
set echo on
@c:\temp\myfile.spec
You should be able to see whats going on like this, including any error messages.
您应该能够看到发生了什么,包括任何错误消息。