Re: Is this a bug...

From: RK <rajXesh_at_hotmail.com>
Date: 13 Sep 2002 10:54:42 -0700
Message-ID: <548b9514.0209130954.44b39a55_at_posting.google.com>


hap_at_mikomi.org (Adam Hapworth) wrote in message news:<a6cb04db.0209121719.2bd3efac_at_posting.google.com>...
> rajXesh_at_hotmail.com (RK) wrote in message news:<548b9514.0209120544.539306df_at_posting.google.com>...
> > Is this a bug?
> > I can define a package as
> > CREATE OR REPLACE PACKAGE testpkg AS
> >
> > TYPE foo IS REF CURSOR;
> > foo NUMBER;
> > foo VARCHAR2 (5);
> > foo DATE;
> > foo CONSTANT number := 4;
> > foo CONSTANT varchar2(6) := 'QWERTY';
> > foo CONSTANT date := SYSDATE;
> >
> > END testpkg;
>
> Actually it is doing exactly what you told it to do. Basically you
> are redefining the variable foo mutiple times. The last time you
> define it is what it will be in your program.

My point exactly. But should it be doing that (redefining) in the package spec. This redefinition is not allowed anywhere else say in a Procedure or a Function or a anonymous block. So why is it allowed in the spec

>
>
> try doing this after you compile you package
>
> SQL> exec dbms_output.put_line(testpkg.foo) -- since foo is a CONSTANT
> 12-SEP-02
> SQL>
>
> What happened is normal and not a bug just "sloppy" coding practices.
>
> Adam

Dont give me crap about "sloppy" coding practices. This happened in one package that is used to store constants. One of the developers had redefined a constant to another value and that caused some other packages to work incorrectly. The assumption made (quite justifiably so) was that Oracle would not allow redefinition of a variable or constant.

I know what it does, but I want to know why it does what it does.

rajXesh Received on Fri Sep 13 2002 - 19:54:42 CEST

Original text of this message