Substitution Variables Using Special Characters (ie. Underscore and Period) Not Getting Parsed Correctly (Doc ID 961774.1)

Last updated on MARCH 08, 2017

Applies to:

SQL*Plus - Version: 10.2.0.1 to 11.1.0.6 - Release: Oracle10g to 11.1
Information in this document applies to any platform.
"Checked for relevance on 30-Jul-2011"

Symptoms

The resulting output filename does not parse correctly when using substitution variables that pass or contain special characters such as:  underscore ( _ ) or the period (.).

-- Steps to Reproduce

1. Run the below example script:
C:\>sqlplus /nolog @D:\control\sql\DbName_DateTime.sql 'TEMPDB'
'20091030_123456'

SQL> set feed on
SQL> set showmode both
new: showmode BOTH
SQL> set verify off
old: verify ON
new: verify OFF
SQL>
SQL> define DBNAME='&1'
SQL> define DATETIME='&2'
SQL>
SQL> connect SYS/SYS@&DBNAME as sysdba
Connected.
SQL> spool D:\control\logs\control_&DBNAME&DATETIME.rpt
SQL>
SQL> alter database backup controlfile to
'D:\bkups\TEMPDB\control_&DBNAME_&DATETIME.ctl';
Enter value for dbname_:

Database altered.

SQL> spool off
SQL> exit


2. The script is creating the following file:

D:\bkups\TEMPDB\control_TEMPDB20091030_123456ctl

NOTE: Notice the missing underscore '_' before the '20091030' and the missing '.' before the 'ctl'

Instead of:

D:\bkups\TEMPDB\control_TEMPDB_20091030_123456.ctl


Cause

Sign In with your My Oracle Support account

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

My Oracle Support provides customers with access to over a
Million Knowledge Articles and hundreds of Community platforms