PLS-00313: ' XXXXX ' not declared in this scope

Source: Internet
Author: User
Package private procedure/function (not declared in package specification) need to be aware of placement

For example, the following package,procedure a wants to call Procedure B,
CREATE OR REPLACE PACKAGE AAAAA authid current_user as
  PROCEDURE A;
End AAAAA;
CREATE OR REPLACE PACKAGE body AAAAA as
  PROCEDURE A is
  BEGIN
    B;
  End;

  PROCEDURE B is the
  BEGIN
    dbms_output.put_line (' in PROCEDURE b ');
  End;

End AAAAA;
There will be an error: PLS-00313: ' B ' not declared in this scope


Reason: B is not public procedure, if a wants to call B, then B's definition must be placed at the front of a.

PLS-00313: "string" not declared in this scope
Cause:there is no declaration for the given identifier within the scope of reference. The identifier might is misspelled, its declaration might to be faulty, or the declaration might is placed incorrectly in the Block structure.
Action:check the spelling and declaration of the identifier. Also confirm the declaration is placed correctly in the block structure.

So the correct wording is:

CREATE OR REPLACE PACKAGE body AAAAA as
  PROCEDURE B are
  BEGIN
    dbms_output.put_line (' in PROCEDURE b ');
  End;
 
  PROCEDURE A is
  BEGIN
    B;
  End;
 
End AAAAA;
Or, if you really want to put B in the back, then you can be in front of the declaration, so that there is no call to the back, there is no error, this is a good habit.
CREATE OR REPLACE PACKAGE body AAAAA as
  PROCEDURE B;
 
  PROCEDURE A is
  BEGIN
    B;
  End;

  PROCEDURE B is the
  BEGIN
    dbms_output.put_line (' in PROCEDURE b ');
  End;

End AAAAA;


reference:http://asktom.oracle.com/pls/apex/f?p=100:11:0::::P 11_question_id:11471812249709


Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.