Oracle FAQ Your Portal to the Oracle Knowledge Grid
HOME | ASK QUESTION | ADD INFO | SEARCH | E-MAIL US
 

Home -> Community -> Usenet -> c.d.o.server -> Problem with PRAGMA RESTRICT_REFERENCES!!!

Problem with PRAGMA RESTRICT_REFERENCES!!!

From: Raj Vuchatu <raj.vuchatu_at_gtri.gatech.edu>
Date: Wed, 04 Nov 1998 15:25:35 -0500
Message-ID: <3640B83F.544639EC@gtri.gatech.edu>


I have defined a funtion( as seen below) in my package spec.

PACAKGE xyz IS...
.........

FUNCTION correctedHours( pHr IN NUMBER, pDate IN DATE, pHrMon IN VARCHAR2 )
    RETURN NUMBER;  PRAGMA RESTRICT_REFERENCES (correctedHours, WNDS, WNPS, RNDS, RNPS);
...................

In my package body, I implemented this function. I tried to use this function in a cursor declaration in a procedure of the package body. But I get an error as shown below when I tried to compile it:

PLS-00452: Subprogram 'CORRECTEDHOURS' violates its associateed pragma PL/SQL: Compilation unit analysis terminated

Where am I doing it wrong? Any help would be appreciated.

My package BODY looks like this

PACKAGE BODY xyz IS
....

FUNCTION correctedHours( pHr IN NUMBER, pDate IN DATE, pHrMon IN VARCHAR2 )
    RETURN NUMBER IS
BEGIN
   IF ( pDate < TO_DATE('01-JUL-1998', 'DD-MON-YYYY') ) THEN

        IF ( pHrMon = '1' ) THEN
          return pHr * 174;
        END IF;

   END IF;
   return pHr;
END;

PROCEDURE makeReport( empNo VARCHAR2, startDate VARCHAR2, endDate VARCHAR2 ) IS     benefitNumber VARCHAR2(1);

    EmpNumber       VARCHAR2(4);
    totalAmt        NUMBER(10,2);
    totalHr         NUMBER(8,2);

    CURSOR aProjectSum IS SELECT t.type_project ||'-'||t.base_project ||'-'||t.sub_project proj, sum(trans_amount) amt,

                              /**********
                                here is where I am using my function
*****************/
                            sum(

xyz.correctedHours(t.hours_or_pct_worked, t.pay_ending_date, t.employee_hours_type) ) hr,
                                     max( project_title) title,
max(unit) unit
                                FROM transactions t, projects_far p
                                WHERE t.cost_type_id IN ('SW', 'PS')
                                    AND  t.benefit_category =
benefitNumber
                                    AND  t.employee_number  = EmpNumber
                                    AND  t.pay_ending_date >=
TO_DATE(startDate, 'DD-MON-RRRR')
                                    AND  t.pay_ending_date <=
TO_DATE(endDate, 'DD-MON-RRRR')
                                    AND  t.type_project = p.type_project

                                    AND  t.base_project = p.base_project

                                    AND  t.sub_project = p.sub_project
                                group by t.type_project, t.base_project,
t.sub_project
                                order by proj;
BEGIN
.......................

Any help would be appreciated,
Raj Received on Wed Nov 04 1998 - 14:25:35 CST

Original text of this message

HOME | ASK QUESTION | ADD INFO | SEARCH | E-MAIL US