Same variable declaration in package

Hi
Please go through below lines of code where I have declared same variable 2 times, which got compiled successfully. But If I do the same in stand alone procedure it throws an error. In case of creation of package it says package created. Can anyone justify to this .....
SQL> create or replace package
2 may221
3 as
4 a number := 10 ;
5 a number := 20 ;
6 procedure p1(a number) ;
7 end ;
8 /
Package created.
SQL> create or replace package body may221
2 as
3 procedure p1(a number)
4 as
5 begin
6 dbms_output.put_line(a) ;
7 end ;
8 end ;
9 /
Package body created.
SQL> set serverout on
SQL> exec may221.p1(20);
20
PL/SQL procedure successfully completed.
SQL> begin
2 dbms_output.put_line(may221.a) ;
3 end ;
4 /
dbms_output.put_line(may221.a) ;
ERROR at line 2:
ORA-06550: line 2, column 32:
PLS-00371: at most one declaration for 'MAY221.A' is permitted in the declaration section
ORA-06550: line 2, column 4:
PL/SQL: Statement ignored
Thanks and Regards
JC

> I checked it's working fine.. no errors..
Oracle version?
There is an error as there are two definitions of variable a. This will generate a run-time error when that variable is used.
However, the result of procedure P1 is not an error.
It is all a matter of scope. Scope determines the resolution of a reference (like a variable name, object name, column name, table name, etc.)
The scope is first local - which means the local code block is checked for resolution. And the variable a is found. In o-o terms, when you refer to variable a it is first resolved as self.a - and only when that fails, the scope changes to the "encapsulating" unit which is the package.
The following code illustrates:
SQL> create or replace package FooPackage is
2 a number := 10;
3 a number := 11;
4
5 procedure Show( a number );
6 end;
7 /
Package created.
SQL> show errors
No errors.
SQL>
SQL>
SQL> create or replace package body FooPackage is
2 procedure Show( a number ) is
3 begin
4 DBMS_OUTPUT.put_line( a ); -- <= resolved as self.a
5 end;
6 end;
7 /
Package body created.
SQL> show errors
No errors.
SQL>
SQL>
SQL> exec FooPackage.Show( 12 )
12
PL/SQL procedure successfully completed.
SQL> exec DBMS_OUTPUT.put_line( FooPackage.a );
BEGIN DBMS_OUTPUT.put_line( FooPackage.a ); END;
ERROR at line 1:
ORA-06550: line 1, column 40:
PLS-00371: at most one declaration for 'FOOPACKAGE.A' is permitted
ORA-06550: line 1, column 7:
PL/SQL: Statement ignored

Similar Messages

  • Variable declaration in Package and package body

    Hi
    Kindly reply the difference in declaring a cursor inside a package vs package body
    eg:
    create or replace package shapak is
    cursor shacur is select * from sha;
    function shafun return number;
    end;
    i can declare the above cursor inside the package body withoout declaring in package specification. but what is the difference?
    reply appreciated
    thanks
    shajan

    In general..Items declared in the package spec are visible outside the package..so you can say public.where as items declared in the body are restricted to use within the package..such items are called private.

  • View of variables declared within a package/procedure

    Does anyone know of a view which holds all the variables declared within a package/function/procedure?
    I can see that _arguments holds the parameters defined.
    PLSQL Developer displays these things in their drop downs, so I assume they are either getting it from a view or have written something which parses the _source view?                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                           

    Do you mean this ?
    SCOTT@db102 SQL> desc dbms_output
    PROCEDURE DISABLE
    PROCEDURE ENABLE
    Argument Name                  Type                    In/Out Default?
    BUFFER_SIZE                    NUMBER(38)              IN     DEFAULT
    PROCEDURE GET_LINE
    Argument Name                  Type                    In/Out Default?
    LINE                           VARCHAR2                OUT
    STATUS                         NUMBER(38)              OUT
    PROCEDURE GET_LINES
    Argument Name                  Type                    In/Out Default?
    LINES                          TABLE OF VARCHAR2(32767) OUT
    NUMLINES                       NUMBER(38)              IN/OUT
    PROCEDURE GET_LINES
    Argument Name                  Type                    In/Out Default?
    LINES                          DBMSOUTPUT_LINESARRAY   OUT
    NUMLINES                       NUMBER(38)              IN/OUT
    PROCEDURE NEW_LINE
    PROCEDURE PUT
    Argument Name                  Type                    In/Out Default?
    A                              VARCHAR2                IN
    PROCEDURE PUT_LINE
    Argument Name                  Type                    In/Out Default?
    A                              VARCHAR2                IN
    SCOTT@db102 SQL>                                         

  • Package variable declaration

    I need to declare Item_To_Go_To package level variable stored in the Instace package for the below code.
    I have create a a package specification in the form as a Program Unit named "Instance".
    Now i need to declare Item_To_Go_To variable which will store control name like
    Instance.Item_To_Go_To := 'myblock.myitem';
    I have controls like text item, list item, Checkbox. How to declare these variables?
    I have used the below one:
    PACKAGE Instance IS
    Item_To_Go_To item;
    END;
    In my example Instance.Item_To_Go_To := 'User.FIRST_NAME';
    is giving expression is a wrong type error. Please let me know what i have done wrong.
    I have used timer expired trigger to overcome my illegal restricted procedure Go_item issue.
    Code snippet.
    Declare
    htimer Timer;
    Begin
    Instance.Item_To_Go_To := 'myblock.myitem';
    Create_Timer( 'wvi_nav_timer', 1, NO_REPEAT);
    End;
    Then in the When-Timer-Expired trigger...
    Begin
    If ( Get_Application_Property( Timer_Name ) = 'wvi_nav_time' ) Then
    Go_Item( Instance.Item_To_Go_To );
    End If;
    End;
    Please refer:
    Alternative trigger like post_change but can 'go_item'
    Edited by: Chris90909 on Jun 12, 2009 12:27 PM

    As you are trying to assign a varchar-value to the variable, you should declare it as varchar2 like:
    PACKAGE Instance IS
      Item_To_Go_To VARCHAR2(61);
    END;

  • Template declaration error when variable assigned is the same as variable declared

    Hi Fedor,
    In comm-central repository, when compiling mozilla/mfbt/Compression.cpp using -std=c++11, it results in an error as follows:
    "../dist/include/mozilla/CheckedInt.h", line 400: Error: Unexpected type name "T" encountered.
    "../dist/include/mozilla/CheckedInt.h", line 400: Error: value is not defined.
    "../dist/include/mozilla/CheckedInt.h", line 400: Error: No direct declarator preceding ">".
    "../dist/include/mozilla/CheckedInt.h", line 400: Error: A declaration does not specify a tag or an identifier.
    "../dist/include/mozilla/CheckedInt.h", line 400: Error: Default template argument cannot be specified on the definition of a class template member that appears outside of its class.
    "../dist/include/mozilla/CheckedInt.h", line 400: Error: Templates can only declare classes or functions.
    "../dist/include/mozilla/CheckedInt.h", line 413: Error: No primary specialization for partial specialization NegateImpl<T, 0>.
    "../dist/include/mozilla/CheckedInt.h", line 416: Error: Too many arguments for template mozilla::detail::NegateImpl<T>.
    8 Error(s) detected.
    After a check on the file CheckedInt.h, it was narrowed down to the following code that resulted in the failure (the variable assigned, isSigned is the same as variable being declared) :
    template<typename T, bool IsSigned = IsSigned<T>::value>
    struct NegateImpl;
    This code, however compiles without problems in gcc-4.8.
    A workaround was to use a different variable declared in the template (e.g. bool IsTSigned = IsSigned<T>). But I just wanted to be sure whether is this a bug in 12.4 Beta or whether coding rules in templates do allow this kind of declaration? Kindly advise. Thanks.
    Regards,
    Brian

    Hi Steve,
    The declaration made below is not valid when -std=c++11 is not used (it causes the same compile-time errors when using July Refresh):
    template<typename U> class IsSigned;
    template<typename T, bool IsSigned = IsSigned<T>::value>
    struct NegateImpl;
    So far, the workaround was to use a different variable declared in the template (e.g. bool IsTSigned = IsSigned<T>).
    Regards,
    Brian

  • Using a static variable declared in an applet in another class

    Hi guys,
    I created an applet and i want to use one of the static variables declared in teh applet class in another class i have. however i get an error when i try to do that...
    in my Return2 class i try to call the variable infoPanel (declared as a static JPanel in myApplet...myApplet is set up like so:
    public class myApplet extends JApplet implements ActionListener, ListSelectionListener
    here are some of the lines causing a problem in the Return2 class:
    myApplet.infoPanel.removeAll();
    myApplet.infoPanel.add(functionForm2.smgframeold);
    myApplet.infoPanel.validate();
    myApplet.infoPanel.repaint();
    here are some of the errors i get
    dummy/Return2.java [211:1] package myApplet does not exist
    myApplet.infoPanel.removeAll();
    ^
    dummy/Return2.java [212:1] package myApplet does not exist
    myApplet.infoPanel.add(functionForm2.smgframeold);
    ^
    dummy/Return2.java [213:1] package myApplet does not exist
    myApplet.infoPanel.validate();
    ^
    dummy/Return2.java [214:1] package myApplet does not exist
    myApplet.infoPanel.repaint();
    ^
    please help! thanks :)

    I don't declare any packages though....i think it just doesn't recognize myApplet for some reason..
    other errors i got compiling are:
    dummy/Return2.java [82:1] cannot resolve symbol
    symbol : variable myApplet
    location: class Return2
    updateDesc.setString(3, myApplet.staticName);
    I Don't get why i'm getting this error cuase they worked fine when myApplet was a standalone application, not an applet.
    myApplet is in the same folder as Return2 and it compiles properly.

  • Variable scope in package

    I have some procedures in a package that need almost the same type of variables. Now, lets say I put them in the package spec in the private variable declaration part so that all the procedures use the same variables instead of declaring them inside all procedures. Now, if someone is executing those procs simultaneously will Oracle Oracle create a separate instance of those variables or use the same copy of the variables for all the simultaneously executing procedures?
    Also, is it a good practise to put these variables in the package body section so that they become public?

    another question!
    is it advisable to put some kind of driver proc in the package such that its job is just to invoke other procs of the package when called like:
    create or replace package body mypack is
    procedure proc proc_main(params) is
    begin
    proc1(params); --invoke other procs
    proc2(params);
    procn(params);
    end ;--end of proc
    --package initialization section
    begin
    proc_main(params);
    end; --end of package                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                               

  • Scope of globle and locale variable of a Package

    I have query about scope of variable declared in spec and body of a package. like
    create or replace package pk_test as
    v_var varchar2(50);
    procedure pk_p_test;
    end ;
    create or replace package body pk_test as
    v_var varchar2(50) := 'aaa';
    procedure pk_p_test
    is
    --v_var varchar2(50) := 'bbbb' ;
    begin
    null;
    --dbms_output.put_line(pk_p_test.v_var);
    dbms_output.put_line(pk_test.v_var);
    dbms_output.put_line(*v_var*);
    end;
    end;
    declare
    begin
    pk_test.v_var := 'qqqqq';
    --dbms_output.put_line(pk_test.v_var);
    pk_test.pk_p_test() ;
    end ;
    package is allowing to declare variable having same name in spec and body.
    But its not allowing to access. is it bug or .. can we access that variable using some methods

    Ah, I think I can see what you are saying.
    Yes, it can be declared in either place, or even declared in both places, but it shouldn't be declared in both.
    One is a "public" state variable and the other is a "private" state variable, so when it creates the package state, they are both marked differently within the state and therefore unique, hence it compiles.
    The public one can be accessed from outside the package, because it's clear to Oracle which is being referred to...
    SQL> create or replace package pk_test as
      2  v_var varchar2(50);
      3  procedure pk_p_test;
      4  end ;
      5  /
    Package created.
    SQL> ed
    Wrote file afiedt.buf
      1  create or replace package body pk_test as
      2    v_var varchar2(50) := 'aaa';
      3    procedure pk_p_test is
      4    begin
      5      null;
      6    end;
      7* end;
    SQL> /
    Package body created.
    SQL> exec pk_test.v_var := 'aaa';
    PL/SQL procedure successfully completed.
    SQL> set serverout on
    SQL> exec dbms_output.put_line(pk_test.v_var);
    aaa
    PL/SQL procedure successfully completed.However if you try and access the variable from inside the package, the body is able to reference both the public and private variables, so it doesn't know which one to use. Hence the compilation error previously seen.
    It's not a bug, because the packages are being flexible to allow for public and private variables, but what you are experiencing just indicates poor package design and lack of understanding of package state variables.

  • Variable Scope at package or interface level

    Hi,
    Can we set the ODI Project variable scope to package or interface level
    because in my project im using a last rundate refresh variable this variable value will be changed at the time of execution of each package.
    Thanxs
    Madhavi

    you can create it as "Not Persistent" and then its value exist per ODI session.
    In this way, several sessions can keep independent value to the same variable.

  • Bind variable issue in Package Body

    When I try to compile my package body, I get an error on the variables declared within the procedure. Bind variable not allowed. Any thoughts?

    Apparently the error was related to something else, and the message was mis-leading. When I re-structured the code for other reasons, the 'error' was no longer showing up. Sorry for the confusion.

  • Bind variable inside a package

    Can we declare a bind variable inside a package specification?
    CREATE OR REPLACE PACKAGE GET_EMPLOYEEDETAILS
    IS
    PROCEDURE GET_FIRSTNAME(E_ID IN EMPLOYEES.EMPLOYEE_ID%TYPE, F_NAME OUT EMPLOYEES.FIRST_NAME%TYPE);
    VARIABLE O VARCHAR2(20);
    END GET_EMPLOYEEDETAILS ;
    CREATE OR REPLACE PACKAGE BODY GET_EMPLOYEEDETAILS
    IS
    PROCEDURE GET_FIRSTNAME(E_ID IN EMPLOYEES.EMPLOYEE_ID%TYPE, F_NAME OUT EMPLOYEES.FIRST_NAME%TYPE)
    IS
    BEGIN
    SELECT FIRST_NAME INTO F_NAME FROM EMPLOYEES WHERE EMPLOYEE_ID = E_ID;
    DBMS_OUTPUT.PUT_LINE(F_NAME);
    END;
    END GET_EMPLOYEEDETAILS;
    Output:
    ERROR at line 4: PLS-00103: Encountered the symbol "VARCHAR2" when expecting one of the following:
      := . ( @ % ; not null range default character
    The symbol ":=" was substituted for "VARCHAR2" to continue.
    2. IS
    3. PROCEDURE GET_FIRSTNAME(E_ID IN EMPLOYEES.EMPLOYEE_ID%TYPE, F_NAME OUT EMPLOYEES.FIRST_NAME%TYPE);
    4. VARIABLE O VARCHAR2(20);
    5. END GET_EMPLOYEEDETAILS ;
    6. /
    or is there any alternative for bind variables inside an package
    Thanks in advance
    Message was edited by: 1009739

    The "VARIABLE O VARCHAR2(20);" syntax is the way SQLPlus declared bind variables - it is specific to the client. Because PL/SQL packages and procedures are server code that continue past sessions, its only access to the client environment is what the client gives it - it can't go and create a bind variable in the client.
    PL/SQL procedures, functions and packages run from lots of environments, so they cannot access bind variables inside their body - you have to pass any external variables as parameters.
    Anonymous PL/SQL blocks can access bind variables.
    You can declare package public global variables - just leave out that "VARIABLE". E.g.
    CREATE OR REPLACE PACKAGE GET_EMPLOYEEDETAILS
    IS
    PROCEDURE GET_FIRSTNAME(E_ID IN EMP.EMPNO%TYPE, F_NAME OUT EMP.ENAME%TYPE);
    O VARCHAR2(20);
    END GET_EMPLOYEEDETAILS ;
    For local variables in your procedure, just put them between the IS and BEGIN. Using them in SQL inside the PL/SQL automatically uses them as a bind variable.
    create or replace PROCEDURE GET_FIRSTNAME(E_ID IN EMP.EMPNO%TYPE, F_NAME OUT EMP.ENAME%TYPE)
    IS
      O VARCHAR2(20);
      O2 VARCHAR2(21);
    BEGIN
      O := 'FR%';
    SELECT ENAME INTO F_NAME FROM EMP WHERE EMPNO = E_ID and ENAME like O;
    O2 := F_NAME || '2';
    DBMS_OUTPUT.PUT_LINE(F_NAME);
    END;
    O is bound in the query.
    To access bind variables from anonymous PL/SQL, first declare them in the calling environment. In SQL Plus that's
    VARIABLE O VARCHAR2(20);
    In Pro*C it's
    EXEC SQL BEGIN DECLARE SECTION;
      char[21] O
    EXEC SQL END DECLARE SECTION;
    Then reference it in anonymous PL/SQL with a colon as prefix:
    BEGIN
    SELECT FIRST_NAME INTO :O FROM EMPLOYEES WHERE EMPLOYEE_ID = E_ID;
    END;
    This only works for anonymous blocks (starting with BEGIN or DECLARE). As I said, PL/SQL procedures, functions and packages cannot see bind variables from the calling environment

  • Class variable declaration

    Hello.
    Just looking through some code and I see a class variable declared as so...
    static final MessageDigest digestFunction;
    static { // The digest method is reused between instances to provide higher entropy.
            MessageDigest tmp;
            try {
                tmp = java.security.MessageDigest.getInstance(hashName);
            } catch (NoSuchAlgorithmException e) {
                tmp = null;
            digestFunction = tmp;
        }I have never come accoss a variable being declared in this way and it looks strange. The use of static before the opening brace is strange to me, and just the fact that this is not inside the constructor. Would this code be run after or before code inside the class constuctor?
    Thanks for any help, just a little confused!

    Sir_Dori wrote:
    Ah yes, of course it could not be within the constructor as it is static, sorry.
    So when would the class be loaded? Could this be the first time the ClassName.staticBlockVar is accessed, Most likely, yes. The first time something else uses the class. Classloading in Java is lazy.
    Also, is the code not reevaluated every time it is referenced ?No. Only when the class is loaded (actually, when it's initialized, but usually it boils down to the same thing)
    You can write some simple tests for this, by writing a constructor and a static initializer, then instantiating it twice, for example. Don't be afraid to just play around with code to test assumptions. I find JUnit very handy for experimenting with assumptions.

  • How to avoid variable declaration dublication in a script?

    Hello to everyone!
    I have a business rule which calls twice same script. But in this sript there is a variable declaration (MethodOpl).
    Rule:
    FIX (&CashFlowPlanningMonths, &PlanningYear, {SelScenario}, {SelVersion})
        %Script(name:="Distribution 100",application:="workapp3",plantype:="Plan1");
    ENDFIX;
    FIX (Jan:Dec, &NextYear, {SelScenario}, {SelVersion})
        %Script(name:="Distribution 100",application:="workapp3",plantype:="Plan1");
    ENDFIX;
    Script:
    VAR MethodOpl = 0;
    FIX (@DESCENDANTS("TotalLocations"), "NoAnalytics", @DESCENDANTS("100000"))
      AmountByPay(
          IF ( NOT @ISMBR(@LIST("114100","115110","115120","115130")) )
            MethodOpl = "BegBalance"->WorkVersion->"NoFRC"->"DistributionByPay";
            IF ( MethodOpl == #Missing )
               MethodOpl = "NoLocation"->WorkVersion->"BegBalance"->"NoFRC"->"DistributionByPay";
            ENDIF;
            ... (some calculations)
          ENDIF;
    ENDFIX;
    If I try to validate rule I get error like this:
    An error occurred in: Rule:workapp3.Plan1.TestOTN
    A validation error was received from the Planning server 'http://ohp:80/HyperionPlanning/servlet/HspAppManagerServlet?appname=workapp3'.
    'Error:Переопределение имени переменной [MethodOpl]. Rule workapp3.Plan1.TestOTN'.
    Error text can be translated as "Error: Redeclaring variable name [MethodOpl]"
    Can you advice me how to avoid second declaration?
    May be somehow like this?
    #IF !DEFINED(MethodOpl)
      VAR MethodOpl;
    #ENDIF
    MethodOpl = 0;

    Try creating a separate script for variable declaration & declare all the variables inside it.Add this script as first statement in the rule
    SCRIPT:  "Var Declaration"
    VAR MethodOpl = 0;
    RULE
    %Script(name:="Var Declaration",application:="workapp3",plantype:="Plan1");
    FIX (&CashFlowPlanningMonths, &PlanningYear, {SelScenario}, {SelVersion})
    %Script(name:="Distribution 100",application:="workapp3",plantype:="Plan1");
    ENDFIX;
    FIX (Jan:Dec, &NextYear, {SelScenario}, {SelVersion})
    %Script(name:="Distribution 100",application:="workapp3",plantype:="Plan1");
    ENDFIX;
    remove the "MethodOpl" variable declaration from the script -"Distribution 100".

  • BSP variable  declaration

    Hello,
    There are 5 BSP applications and many URL are there, i have to insert URLs of reoprts in BSP applications
    so URL is very large for all the reports but in the URL only the Technical name is different and other remain same
    like example:
    "http://xxxiprd:8xxx/sap/bw/BEx?cmd=ldoc&template_id=technicalname &sap-language=EN"
    can we create a variable for url and concatinate into html page and using same variable along with URL as follows
    var link1 = http://xxxiprd:8xxx/sap/bw/BEx?cmd=ldoc&template_id=
    var link2 = &sap-language=EN
    concatinate link1 technical name link2 into html page..
    How to do the above process and where to declare globally
    can any give steps for the same.......

    Hi Pooja,
    The processing type of a variable may be varies from business requirement.
    In general we will use the processing type:
    Replacement Path : If you specify a variable as a characteristic value, you do not have to specify a text for the characteristic value right away. Instead, you can fill the text field dynamically and specifically for the characteristic that you use for the variable when you execute the query. To do this, define a text variable with automatic replacement.
    [http://help.sap.com/saphelp_nw70/helpdata/EN/bd/589b3c494d8e15e10000000a114084/content.htm]
    Authorisations: If the user belongs to Asia PAciffic region and he must see only details of his region then we can create a variable Region vt Processing type Authorisations so that he vl able to see only that region's data.
    [http://help.sap.com/saphelp_nw70/helpdata/EN/44/599b3c494d8e15e10000000a114084/content.htm]
    SAP EXIT: If you want to define a query that only ever displays the data from the current month, drag the delivered variable “current month” (technical name 0CMONTH) for the characteristic “calendar year/month” (technical name 0CMONTH) into the query filter.
    [http://help.sap.com/saphelp_nw70/helpdata/EN/f1/0a5702e09411d2acb90000e829fbfe/content.htm]
    Customer Exit: You want to use one characteristic value to calculate a second characteristic value. The InfoProvider only contains the calendar day. However, you now also want to display the cumulated value for the relevant period (beginning with the first day of a quarter) in a query.
    For the first day of the quarter, use a variable with customer exit processing. If you now enter the current calendar day (for example, 06/19/2000), a start date of 06/01/2000 appears in the customer exit, and the cumulated value of this period can be displayed.
    [http://help.sap.com/saphelp_nw70/helpdata/EN/f1/0a56f5e09411d2acb90000e829fbfe/content.htm]
    I hope this helps you.

  • Unexpected Fortran compiler behavior on variable declarations.

    There are several problems concerning Sun Fortran compiler for Linux, concerning variable declarations:
    (1) A variable can be declared two or more times within the same
    program scope. Surprisingly, the compiler accepts this, without any error or
    warning message. This is clearly a bug.
    (2) There is no warning message if a variable is used but never set, even if the -w4 flag is used. This is a serious bug.
    (3) There is no warning message if a variable is declared but never
    used.
    To illustrate the bugs, compile the following simple program:
    module fooModule
    implicit none
    public :: add
    contains
    function add(x,y)
    real, intent(in) :: x,y
    real :: unused ! This variable is never used and never set; no warning message.
    real :: add
    add=x+y
    end function add
    end module fooModule
    program TryProg
    use fooModule
    implicit none
    real :: x
    integer :: i
    integer :: i ! Duplicated declaration. The compiler accepts this!
    i=3
    print*,i
    print*,add(x,2.0) ! Variable x is used but not set; no warning message.
    end program TryProg
    EXPECTED BEHAVIOR:
    (1) Something like "ERROR: Duplicate declaration of 'i'" or "ERROR:
    Symbol 'i' already has basic type of INTEGER."
    (2) WARNING: Variable 'x' is used but not set.
    (3) WARNING: Variable 'unused' is never used and never set.
    ACTUAL BEHAVIOR:
    No error or warning messages; expected one error and two warnings.
    The bugs appear in all Fortran compilers for Linux, including latest release, SSX2.

    There are several problems concerning Sun Fortran
    compiler for Linux, concerning variable
    declarations:
    (1) A variable can be declared two or more times
    within the same
    program scope. Surprisingly, the compiler accepts
    this, without any error or
    warning message. This is clearly a bug.
    The bugs appear in all Fortran compilers for Linux,
    including latest release, SSX2.You have cited a number of constraint violations. The
    Fortran standard states
    A processor conforms to this standard if
    (3) It contains the capability to detect and report the
    use within a sumitted program unit of an
    additional form or relationship that is not
    permitted by the numbered syntax rules or
    constraints, including the deleted features
    described in Annex B;
    In English, this statement means that a conforming
    implementation must be able to detect and report
    syntax errors and constraint violations. It does not
    mean that it must detect and report them by default.
    Sun f95, like most other Fortran compilers, does not
    give errors or warnings for the use of common
    extensions by default. The option -ansi enables
    the compilation mode that reports such uses.
    For example, when I compile the program
    PROGRAM MAIN
    REAL X
    REAL X
    END
    with the option -ansi, I get
    REAL X
    ^
    "t.f", Line = 2, Column = 1: ANSI: Use of the tab character is an extension of the Fortran standard.
    REAL X
    ^
    "t.f", Line = 3, Column = 7: ANSI: "X" has been given the REAL attribute more than once. This is nonstandard.
    f90comp: 4 SOURCE LINES
    f90comp: 0 ERRORS, 0 WARNINGS, 0 OTHER MESSAGES, 2 ANSI
    The caret lines up with the identifer X in the output. The column
    number is given as column 7, because the letter X is the seventh
    character in the line.

Maybe you are looking for