0

参考Oracle 11g PL/SQL Positions of CONTANT variables in PACKAGE PL/SQL 编译器如何处理这种方法:

  FUNCTION PARSER(IN_VALUE IN VARCHAR2) RETURN VARCHAR2 IS
    LC_PARAM CONSTANT VARCHAR2(10) := 'USERNAME';
    LC_MSG   CONSTANT VARCHAR2(80) := REPLACE('Hello USERNAME! How are you today?', LC_PARAM, IN_VALUE);
  BEGIN
    RETURN REPLACE(LC_MSG, LC_PARAM, LC_PARAM);
  END PARSER;

甚至这个:

  FUNCTION PARSER(IN_PARAM IN VARCHAR2,
                  IN_VALUE IN VARCHAR2) RETURN VARCHAR2 IS
    LC_MSG CONSTANT VARCHAR2(80) := REPLACE('Hello USERNAME! How are you today?', IN_PARAM, IN_VALUE);
  BEGIN
    RETURN REPLACE(LC_MSG, IN_PARAM, IN_PARAM);
  END PARSER;
4

0 回答 0