My Oracle Support Banner

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: to - Release: Oracle10g to 11.1
Information in this document applies to any platform.
"Checked for relevance on 30-Jul-2011"


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'

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

Database altered.

SQL> spool off
SQL> exit

2. The script is creating the following file:


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

Instead of:



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.