Oracle FAQ | Your Portal to the Oracle Knowledge Grid |
Home -> Community -> Usenet -> c.d.o.server -> Re: PL/SQL constants in packages/stored packages
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;
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