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

Home -> Community -> Usenet -> c.d.o.tools -> Re: PL/SQL Tip of the Month

Re: PL/SQL Tip of the Month

From: Matthias Gresz <GreMa_at_t-online.de>
Date: 1997/12/30
Message-ID: <68akl5$9i8$1@news01.btx.dtag.de>#1/1

Steve Jelfs wrote:
>
> Cam White wrote:
> >
 

> >
> > CREATE OR REPLACE PACKAGE app_types
> > IS
> > SUBTYPE primary_key IS order.order_id%TYPE;
> > END;
> > /
> >
> > Then whenever you need to declare a variable of type "primary key", you do
> > it like this:
> >
> > DECLARE
> > my_id app_types.primary_key;
> > BEGIN
> > ...
> >
> > Notice that you do not need to use the %TYPE attribute on the declaration.
>
> And how does this differ from
>
> DECLARE
> my_id order.order_id%TYPE;
> BEGIN
> ....
> END;
>
> ?
>
> Sj

in case of changes (taking another's table pk as datatype) you've only got to change one LOC and not every occurence of "my_id order.order_id%TYPE".

-- 
Regards

Matthias Gresz    :-)
Received on Tue Dec 30 1997 - 00:00:00 CST

Original text of this message

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