PL/SQL problem

From: Chris Eastland <chrise_at_shore.net>
Date: 1996/09/26
Message-ID: <52e7te$rs9_at_northshore.shore.net>


We are having a problem with PL/SQL in that it seems to be mixing up functions that have the same name but different arguments, and which exist in different packages. For example, in package pte_core below the declaration for function GetEmpId takes no input arguments and returns NUMBER but in package pa_utils there is also a function called GetEmpid with input argument VARCHAR2 returning NUMBER - Cross-package function overloading if you will..

When we try to compile package pte_core we get the results shown below. As you can see, the error PLS-00452 specifically, where it seems the compiler is not recognizing the pa_utils prefix when checking the declaration against the statement invoking the function.

We are using PL/SQL version 2.1.6.2.0 with database version 7.1.6.2.0 on HP-UX 10.01.

chris

SQL> sho errors
Errors for PACKAGE BODY PTE_CORE:
LINE/COL ERROR                                                                  
-------- -----------------------------------------------------------------      
0/0      PL/SQL: Compilation unit analysis terminated                           
13/3     PLS-00452: Subprogram 'GETEMPID' violates its associated pragma        

SQL> exit

  • PACKAGE pte_core ====================================
Package pte_core AS                                                             

/* $Header: PAPTEXXS.pls 31.0 96/05/30 22:36:56 porting ship $ */
TYPE GlobalEmpNo IS RECORD ( EmpNo VARCHAR2(30) ); PROCEDURE InitEmpNo (XempNo IN VARCHAR2); FUNCTION GetEmpNo RETURN VARCHAR2; pragma RESTRICT_REFERENCES ( GetEmpNo, WNDS, WNPS ); FUNCTION GetEmpId RETURN NUMBER; <==== NOTE no input argument pragma RESTRICT_REFERENCES ( GetEmpId, WNDS, WNPS ); FUNCTION GetEmpName RETURN VARCHAR2; pragma RESTRICT_REFERENCES ( GetEmpName, WNDS, WNPS ); FUNCTION GetMaxLocalExpId RETURN NUMBER; pragma RESTRICT_REFERENCES ( GetMaxLocalExpId, WNDS, WNPS ); FUNCTION GetMaxLocalItemId RETURN NUMBER; pragma RESTRICT_REFERENCES ( GetMaxLocalItemId, WNDS, WNPS ); FUNCTION GetImpExpEndDayNum RETURN NUMBER; pragma RESTRICT_REFERENCES ( GetImpExpEndDayNum, WNDS, WNPS ); FUNCTION GetExpRepPaidAmt (X_exp_id IN NUMBER) RETURN NUMBER; pragma RESTRICT_REFERENCES ( GetExpRepPaidAmt, WNDS, WNPS ); FUNCTION GetExpStatus (X_exp_id IN NUMBER) RETURN VARCHAR2; pragma RESTRICT_REFERENCES ( GetExpStatus, WNDS, WNPS ); PROCEDURE FlushXfaceTable (X_xface_id IN NUMBER); GempNo GlobalEmpNo; END pte_core; PACKAGE BODY pte_core AS
/* $Header: PAPTEXXB.pls 31.1 96/05/30 22:36:49 porting ship $ */
PROCEDURE InitEmpNo ( XempNo IN VARCHAR2 ) IS BEGIN GempNo.EmpNo := XempNo; END InitEmpNo; FUNCTION GetEmpNo RETURN VARCHAR2 IS BEGIN RETURN(GempNo.EmpNo); END GetEmpNo; FUNCTION GetEmpId RETURN NUMBER <======= LINE 13 matches declaration IS X_empId NUMBER; BEGIN X_empId := pa_utils.GetEmpId(pte_core.GetEmpNo); <======= Error reported on this RETURN (X_empId); END GetEmpId; FUNCTION GetEmpName RETURN VARCHAR2 IS X_emp_name VARCHAR2(240); BEGIN SELECT first_name || ' ' || last_name INTO X_emp_name FROM
pa_employees WHERE person_id = pte_core.GetEmpId; RETURN( X_emp_name ); EXCEPTION WHEN NO_DATA_FOUND THEN RETURN( NULL ); END GetEmpName;
Received on Thu Sep 26 1996 - 00:00:00 CEST

Original text of this message