MSCEWI3122

Package Variable Assignment transformation

Severity

Low

Description

A Package Variable assignment was transformed to a custom UDF in order to keep the functional equivalence. A TO_VARCHAR function is applied to the right expression of the assignment because all the package variables are declared as strings.

Example Code

Input Code:

-- PACKAGE DECLARATION
CREATE OR REPLACE PACKAGE PKG AS
    PKG_VAR1 INTEGER := 100;
	PROCEDURE P1;
END PKG;

-- PACKAGE BODY DEFINITION
CREATE OR REPLACE PACKAGE BODY PKG AS
  PROCEDURE P1 IS
  BEGIN
    -- PACKAGE VARIABLE ASSIGNMENT
    PKG_VAR1 := 40;
  END P1;
END PKG;
/

Output Code:

Recommendations

  • Check if the format parameter of the TO_VARCHAR function is required for the scenario.

  • For DATE, DATETIME, TIME, or TIMESTAMP data types check the DATE_INPUT_FORMAT and TIMESTAMP_INPUT_FORMAT session parameters. Those values will affect the TO_VARCHAR function's correct execution.

  • If you need more support, you can email us at [email protected]

Last updated