I have a function that calls a package Call_Package. Within this package I have a procedure Validate_Procedure, and within this procedure I have a variable Entity_Flag.
The function calls my package as such:
BEGIN
Call_Package(<params>);
END
the ‘Call_Package’ contains my procedure Validate_Procedure as such:
Validate_Procedure(<paramA>, <paramB>)
within the procedure I do stuff, like normal:
Validate_Procedure(<params>) IS
BEGIN
IF <paramA> THEN
Entity_Flag = 1
Else <paramB> THEN
Entity_Flag = 2
END IF
END
my question is, can I reference the procedural variable in my original function, like so:
BEGIN
Call_Package(<params>);
IF Call_Package.Validate_Procedure.Entity_Flag = 2 THEN
{do stuff}
END IF
END
First, you cannot call a package. A package is not an executable entity. It is simply a collection of procedures, functions, package variables, etc.
If
Entity_Flagis a local variable within theValidate_Procedureprocedure, you cannot reference it from outsideValidate_Procedure. In the code you posted showing how theValidate_Procedureprocedure is defined, however, you are not declaringEntity_Flag. That may be an oversight or it may indicate thatEntity_Flagis not a local variable at all. Perhaps it is a package global variable. If the variable is defined in the package specification, you could reference it outside the package, asCall_Package.Entity_Flag. If the variable is defined in the package body, however, you can only reference it from inside another PL/SQL block defined in the package body.