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 -> Re: Global Constants in PL/SQL?

Re: Global Constants in PL/SQL?

From: Jonathan Ingram <jingram_at_teleport.com>
Date: 1997/05/27
Message-ID: <338b53da.112155360@news.teleport.com>#1/1

On Tue, 27 May 1997 16:34:52 -0400, Tim Frangioso <tfrangio_at_mitre.org> wrote:

>HI,
> I am looking for a way to define constants in PL/SQL and for a way to
>declare a user defined record global for a number of procedures.
> What I realy would like is a way to duplicate C's include statements so
>that I can have exteral defintions that are all defined in one place.
>If anyone could help I would be eternaly grateful.
You can do this by creating the constants and datatype in a package spec, like so:

CREATE OR REPLACE PACKAGE SPEC Globals

AS

   ORGANIZATION_NAME CONSTANT varchar2 (30) :=

         'US Department of the Interior';

   TYPE Names_tabtype IS
   TABLE OF varchar2 (30) INDEX BY binary_integer;

END Globals;

You can then reference the constants and datatypes in your code by referencing them like a packaged procedure or function:

    vOrgName varchar2 (30) := Globals.ORGANIZATION_NAME;

    Names_tab Globals.Names_tabtype;

Hope this helps out :)

Jonathan Ingram Received on Tue May 27 1997 - 00:00:00 CDT

Original text of this message

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