开发者

Simple Oracle Stored Procedure getting Invalid object error

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 wh开发者_运维问答en 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


Don't use the DECLARE keyword in a stored procedure declaration. Remove that and it should compile.

0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜