Oracle - 源没有可运行的目标
我对 Oracle 完全陌生。
我正在尝试创建一个包,但它抛出一个错误: 源没有可运行的目标。
我想要做的是创建一个包并在包体中定义一些存储过程。
这是我的包定义的样子:
CREATE OR REPLACE
PACKAGE PAY_ZONE_PKG AS
TYPE CURSOR_TYPE IS REF CURSOR;
PROCEDURE spGetZones(Zones_Cursor OUT CURSOR_TYPE);
END PAY_ZONE_PKG;
这是我的包主体的样子:
create or replace
PACKAGE BODY PAY_ZONE_PKG IS
PROCEDURE spGetZones(Zones_Cursor OUT CURSOR_TYPE) AS
BEGIN
OPEN Zones_Cursor FOR
SELECT *
FROM ESP.PAY_ZONE
ORDER BY NAME ASC;
EXCEPTION
WHEN NO_DATA_FOUND
THEN NULL;
END spGetZones;
END PAY_ZONE_PKG;
当我尝试创建包主体时,它会抛出错误,指出
cannot compile body of 'PAY_ZONE_PKG' without its specification
我在这里缺少什么?
I am completely new to Oracle.
I am trying to create a package but it throws me an error:Source does not have a runnable target.
What i want to do is create a package and define some stored procs in the package body.
This is how my package definition looks like:
CREATE OR REPLACE
PACKAGE PAY_ZONE_PKG AS
TYPE CURSOR_TYPE IS REF CURSOR;
PROCEDURE spGetZones(Zones_Cursor OUT CURSOR_TYPE);
END PAY_ZONE_PKG;
This is how my package body looks like:
create or replace
PACKAGE BODY PAY_ZONE_PKG IS
PROCEDURE spGetZones(Zones_Cursor OUT CURSOR_TYPE) AS
BEGIN
OPEN Zones_Cursor FOR
SELECT *
FROM ESP.PAY_ZONE
ORDER BY NAME ASC;
EXCEPTION
WHEN NO_DATA_FOUND
THEN NULL;
END spGetZones;
END PAY_ZONE_PKG;
When i tried to create package body, it throws the error saying
cannot compile body of 'PAY_ZONE_PKG' without its specification
What am i missing here?
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(2)
无法在没有规范的情况下编译“PAY_ZONE_PKG”主体
表示创建或替换包 PAY_ZONE_PKG
失败,或者在尝试编译包规范后被删除身体。所以,问题不在于身体,而在于规格。
cannot compile body of 'PAY_ZONE_PKG' without its specification
indicates that thecreate or replace package PAY_ZONE_PKG
was either unsucessful, or that the package specification was deleted after it was tried to compile the body.So, the problem is not with the body, but with the specification.
我无法重现这一点。
代码:
编译。
并且身体也创建成功了。
您是否尝试过独立创建它们?第一个规格,然后是主体。
I'm not able to reproduce that.
The code:
compiles.
And also the body is created successfully.
Have you tried to create them independently. First spec, and after, body.