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 -> Re: PL/SQL constants in packages/stored packages

Re: PL/SQL constants in packages/stored packages

From: Jurij Modic <jurij.modic_at_mf.sigov.mail.si>
Date: 1997/07/15
Message-ID: <33cbd659.2805648@www.sigov.si>#1/1

On Tue, 15 Jul 1997 10:58:23 -0600, dpcaldwell_at_sherwin.com wrote:

>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.
>
> .......[SNIP].....
This kind of declaration of constants is perfectly legal in packages. To convince yourself try the foloving from SQL*Plus:

SQL> CREATE OR REPLACE PACKAGE const AS
  2 max_widgets_per_day CONSTANT INTEGER := 1000;   3 END const;
  4 /

Package created.

SQL> BEGIN
  2 dbms_output.put_line('Constant from package: ' ||

  3                         TO_CHAR(const.max_widgets_per_day));
  4 END;
  5 /
Constant from package: 1000

PL/SQL procedure successfully completed.

SQL> So IMHO the reasons for your problem is probably in a way you reference this constants in your aplication. Can you supply some more information about the error stack you are getting and some more of aplication code that is causing the error?

Regards,


Jurij Modic                             Republic of Slovenia
jurij.modic_at_mf.sigov.mail.si		Ministry of Finance
============================================================
The above opinions are mine and do not represent any official standpoints of my employer Received on Tue Jul 15 1997 - 00:00:00 CDT

Original text of this message

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