Oracle FAQ | Your Portal to the Oracle Knowledge Grid |
![]() |
![]() |
Home -> Community -> Usenet -> c.d.o.tools -> Re: PL/SQL Tip of the Month
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
![]() |
![]() |