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

Home -> Community -> Mailing Lists -> Oracle-L -> Redeclaration of Global variables...

Redeclaration of Global variables...

From: Manu Sankar <manusankar_at_gmail.com>
Date: Thu, 16 Mar 2006 19:24:16 +0530
Message-ID: <f1e129480603160554p7aac91f1xae40669bfd16777b@mail.gmail.com>


Hi,

While redeclaration of variables is not allowed in anonymous blocks, the same is being allowed in Package specs.

What could be the reason behind it ?

Following script can give you a test case

declare
g_num number(2):=10;
g_num varchar2(10):='test';
begin
dbms_output.put_line('g_num is '||g_num); end;
/

You will hit the error

 PLS-00371: at most one declaration for 'G_NUM' is permitted in the declaration section

Try this

create package glb_test as
g_num number:=10;
g_num varchar2(10):='test';
end;
/

exec dbms_output.put_line('G_num is '||glb_test.g_num);

You dont hit any error though g_num has been declared twice....

Thanks
-Manu

--
http://www.freelists.org/webpage/oracle-l
Received on Thu Mar 16 2006 - 07:54:16 CST

Original text of this message

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