IBM Support

IC84061: SQL0206N RETURNED WHEN REFERENCING VARIABLE IN ANOTHER ORACLE PACKAGE WITH SAME NAME.

Subscribe

You can track all active APARs for this component.

 

APAR status

  • Closed as program error.

Error description

  • You will receive error SQL0206N when the following
    conditions are met:
    
    - A PL/SQL function declares a local variable and also contains
    a package-qualified reference to a package variable with the
    same name as the local variable.
    
    - The local variable appears in a RETURN statement in the
    function.
    
    For example:
    
    create or replace package package1
    as
      v_test varchar2(10) := 'test';
    end package1;
    /
    
    create or replace function f
    return varchar2
    is
      v_test varchar2(10);
    begin
      v_test := package1.v_test;
      return v_test;
    end f;
    /
    
    The same error can occur in compiled SQL PL functions that
    reference a local variable with the same name as a module
    variable in a RETURN statement.  For example:
    
    create module M %
    
    alter module M publish variable v_test varchar(10)
      default 'test' %
    
    create or replace function f()
    returns varchar(10)
    begin
      declare v_test varchar(10);
    
      set v_test = M.v_test;
      return v_test;
    end %
    

Local fix

  • Rename the local variable so that it does not have the same
    name as the package variable.  Using the PL/SQL example from
    the error description:
    
    -- Rename 'v_test' as 'v_testx' to work around name
    -- resolution error with 'package1.v_test':
    
    create or replace function f
    return varchar2
    is
      v_testx varchar2(10);
    begin
      v_testx := package1.v_test;
      return v_testx;
    end f;
    /
    

Problem summary

  • ****************************************************************
    * USERS AFFECTED:                                              *
    * ALL                                                          *
    ****************************************************************
    * PROBLEM DESCRIPTION:                                         *
    * See Error Description                                        *
    ****************************************************************
    * RECOMMENDATION:                                              *
    * Apply DB2 Version 9.7 Fix Pack 7 to the DB2 database server. *
    ****************************************************************
    

Problem conclusion

  • Problem first fixed in DB2 Version 9.7 Fix Pack 7.  This is a
    server side fix.
    

Temporary fix

Comments

APAR Information

  • APAR number

    IC84061

  • Reported component name

    DB2 FOR LUW

  • Reported component ID

    DB2FORLUW

  • Reported release

    970

  • Status

    CLOSED PER

  • PE

    NoPE

  • HIPER

    NoHIPER

  • Special Attention

    NoSpecatt

  • Submitted date

    2012-06-11

  • Closed date

    2012-10-20

  • Last modified date

    2012-10-20

  • APAR is sysrouted FROM one or more of the following:

  • APAR is sysrouted TO one or more of the following:

Fix information

  • Fixed component name

    DB2 FOR LUW

  • Fixed component ID

    DB2FORLUW

Applicable component levels

  • R970 PSN

       UP

[{"Business Unit":{"code":"BU048","label":"IBM Software"},"Product":{"code":"SSEPGG","label":"DB2 for Linux, UNIX and Windows"},"Component":"","ARM Category":[],"Platform":[{"code":"PF025","label":"Platform Independent"}],"Version":"9.7","Edition":"","Line of Business":{"code":"LOB10","label":"Data and AI"}}]

Document Information

Modified date:
20 October 2012