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: Robert Christenson <robertoc_at_fyiowa.infi.net>
Date: 1997/07/16
Message-ID: <33CCEE45.7CE8@fyiowa.infi.net>#1/1

This is a serious drawback to D2K. There is no direct reference to stored package variables. Your only option is to build functions and procedures in the package to manipulate your constant. Have your app call these to get & set your constant.

Another gripe of mine (and maybe of yours soon) is you can't indirectly set a package variable within these get & set routines, because there is no equivalent to COPY & NAME_IN in PL/SQL. You have to know the variable you want to set. (BTW, if anyone can solve that for me, please reply)

If you're using stored procs and packages, you may also run into this: D2K does not support direct procedure calls either. You have to create a synonym and grant execute on it. Then your app can execute that. FYI Good Luck!:)

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.
>
> 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
 

-- 
"Came for the party, left on the run"

Robert Christenson
Gazette Technologies
robertoc#spam~be~gone#@fyiowa.infi.net
Received on Wed Jul 16 1997 - 00:00:00 CDT

Original text of this message

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