Oracle Error PLS-00492: variable or constant initialization may not refer to functions declared in the same package

Oracle Error Message

PLS-00492: variable or constant initialization may not refer to functions declared in the same package

Reason for the Error

If a package spec p declares a function f, that function may not be used in any variable declarations in that same package spec. This is because of a circular instantiation problem: in order to fully instantiate the package spec, the variable must be initialized. To initialize the variable, the function body code in the package body must be executed. That requires that the package body be instantiated. However, the package body cannot be instantiated until the package spec is fully instantiated.

Solution

Remove the reference to the function from the variable initialization. A technique which often works is to move the variable initialization from the variable declaration (in the package spec) to the package body initialization block.

Share:

Leave A Reply

Your email address will not be published. Required fields are marked *

You May Also Like

Oracle Error Message ORA-24328: illegal attribute value Reason for the Error The attribute value passed in is illegal. Solution Consult...
Oracle Error Message ORA-01346: LogMiner processed redo beyond specified reset log scn Reason for the Error LogMiner has detected a...
Oracle Error Message ORA-13241: specified dimensionality does not match that of the data Reason for the Error An error occurred...