DB2 - Problem description
Problem IC84061 | Status: Closed |
SQL0206N RETURNED WHEN REFERENCING VARIABLE IN ANOTHER ORACLE PACKAGE WITH SAME NAME. | |
product: | |
DB2 FOR LUW / DB2FORLUW / 970 - DB2 | |
Problem 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 % | |
Problem Summary: | |
**************************************************************** * USERS AFFECTED: * * ALL * **************************************************************** * PROBLEM DESCRIPTION: * * See Error Description * **************************************************************** * RECOMMENDATION: * * Apply DB2 Version 9.7 Fix Pack 7 to the DB2 database server. * **************************************************************** | |
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; / | |
available fix packs: | |
DB2 Version 9.7 Fix Pack 7 for Linux, UNIX, and Windows | |
Solution | |
Problem first fixed in DB2 Version 9.7 Fix Pack 7. This is a server side fix. | |
Workaround | |
not known / see Local fix | |
Timestamps | |
Date - problem reported : Date - problem closed : Date - last modified : | 11.06.2012 20.10.2012 20.10.2012 |
Problem solved at the following versions (IBM BugInfos) | |
9.7.FP7 | |
Problem solved according to the fixlist(s) of the following version(s) | |
9.7.0.7 |