简单的 Oracle 存储过程出现无效对象错误
我正在尝试编写一个简单的 Oracle 存储过程:
CREATE OR REPLACE PROCEDURE act.skeleton
IS
DECLARE
v_rowCount NUMBER;
BEGIN
SELECT COUNT(1) INTO v_rowCount FROM ex.emp;
DBMS_OUTPUT.PUT_LINE(v_rowCount);
END;
但是,当我尝试 &通过在 PL/SQL Developer 命令窗口中发出 execute act.sculpture
来运行该过程,我收到以下错误消息:
ORA-06550: line 1, column 11:
PLS-00905: object ACT.SKELETON is invalid
ORA-06550: line 1, column 7:
PL/SQL: Statement ignored
我尝试在没有 create procedure 语句的情况下运行代码它运行成功并显示输出。我已经尝试了 CREATE OR REPLACE PROCEDURE IS
& CREATE OR REPLACE PROCEDURE AS
选项,但我仍然遇到相同的错误。
我不确定当我尝试执行该过程时,这是否与该过程的授权或可见性有关,或者是什么导致 act.sculpture
对象无效。我研究了错误的含义&看起来它通常是指过程中的编译错误,但由于我可以在没有过程声明的情况下运行代码,我猜测声明部分是罪魁祸首。我只是不知道到底是什么原因造成的,我希望有人能够提供更多信息并为我指明正确的方向
谢谢,
Ashish
其他详细信息:
Oracle Database 10g Enterprise Edition Release 10.2.0.4.0 - 64bi
PL/SQL Release 10.2.0.4.0 - Production
I am trying to write a simple Oracle Stored Procedure:
CREATE OR REPLACE PROCEDURE act.skeleton
IS
DECLARE
v_rowCount NUMBER;
BEGIN
SELECT COUNT(1) INTO v_rowCount FROM ex.emp;
DBMS_OUTPUT.PUT_LINE(v_rowCount);
END;
However, when I try & run the procedure by issuing execute act.skeleton
in PL/SQL Developer command window, I get the following error message:
ORA-06550: line 1, column 11:
PLS-00905: object ACT.SKELETON is invalid
ORA-06550: line 1, column 7:
PL/SQL: Statement ignored
I tried to just run the code without the create procedure statement & it runs successfully with the output being displayed. I have tried both CREATE OR REPLACE PROCEDURE IS
& CREATE OR REPLACE PROCEDURE AS
options but I still get the same error.
I am not sure if this has anything to do with authorization or visibility of the procedure when I try and execute it or what is causing the act.skeleton
object to be invalid. I looked into what the error means & it seems it usually refers to compilation error in the procedure but since I can run the code sans the procedure declaration, I am guessing the declaration piece is the culprit. I just don't know enough to figure out what is causing this and I was hoping that someone will be able to shed some more light on it and point me in the right direction
Thanks,
Ashish
Other Details:
Oracle Database 10g Enterprise Edition Release 10.2.0.4.0 - 64bi
PL/SQL Release 10.2.0.4.0 - Production
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(1)
不要在存储过程声明中使用
DECLARE
关键字。删除它,它应该可以编译。Don't use the
DECLARE
keyword in a stored procedure declaration. Remove that and it should compile.