Concatenating Strings Results In Value Treated as a Literal Instead of a Variable.
Last updated on JULY 05, 2017
Applies to:PL/SQL - Version: 10.2.0.4
Information in this document applies to any platform.
The objective is to be able to pass in either a 1 or a 2 so that within the DBMS_OUTPUT.PUT_LINE call, either variable a1 or a2 will be displayed.
Instead, the variable is being treated like a literal 'a1' or 'a2' but the goal is to concatenate to build a variable then get its value.
create or replace procedure new_test (p1 number) is
a1 number := 22;
a2 varchar2(20) := 'Test';
SQL> execute new_test(1);
Notice that the literal 'a1' is displayed instead of the 22 which is the value stored in the a1 variable.
SQL> execute new_test(2);
Notice that the literal 'a2' is displayed instead of the value 'Test' which is the value stored in the a2 variable.
Sign In with your My Oracle Support account
Don't have a My Oracle Support account? Click to get started
Million Knowledge Articles and hundreds of Community platforms