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

Home -> Community -> Usenet -> c.d.o.misc -> PL/SQL constants in packages/stored packages

PL/SQL constants in packages/stored packages

From: <dpcaldwell_at_sherwin.com>
Date: 1997/07/15
Message-ID: <868980011.5058@dejanews.com>#1/1

Hello all.

I have been attempting to store systemwide constants in a stored PL/SQL package. My first attempt was the following:

CREATE PACKAGE const AS

     max_widgets_per_day CONSTANT INTEGER := 1000; END const;

Application

     IF widgets > const.max_widgets_per_day THEN
         ...


***
But this doesn't work. I get an "unknown column" error when
accessing const.variable_name. In order to preserve this nomenclature, I wrote one-line functions, i.e.

CREATE PACKAGE const AS

    FUNCTION max_widgets_per_day RETURN INTEGER;

       PRAGMA RESTRICT_REFERENCES (max_widgets_per_day, WNDS); END;
CREATE PACKAGE BODY const AS

    FUNCTION max_widgets_per_day RETURN INTEGER IS BEGIN RETURN 100; END; END;
***

    A whole new class of systemwide constants is about to be created corresponding to error codes, so I am revisiting the issue: is there any way to do this using the first nomenclature, rather than the second? (I haven't tried it, but as I understand it the first method works for non-stored packages, just not for stored ones.)

Many thanks.

-------------------==== Posted via Deja News ====-----------------------
      http://www.dejanews.com/     Search, Read, Post to Usenet
Received on Tue Jul 15 1997 - 00:00:00 CDT

Original text of this message

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