My Oracle Support Banner

Concatenating Strings Results In Value Treated as a Literal Instead of a Variable. (Doc ID 1083793.1)

Last updated on JULY 16, 2019

Applies to:

PL/SQL - Version: and later   [Release: 10.2 and later ]
Information in this document applies to any platform.


In this sample, there are two variables 'a1' and 'a2'.
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.


To view full details, sign in with your My Oracle Support account.

Don't have a My Oracle Support account? Click to get started!

In this Document

This document is being delivered to you via Oracle Support's Rapid Visibility (RaV) process and therefore has not been subject to an independent technical review.

My Oracle Support provides customers with access to over a million knowledge articles and a vibrant support community of peers and Oracle experts.