| Whitespace Support in Windows Path and File Names Support for whitespaces in file names has been added to the START, @, @@, RUN, SPOOL, SAVE and EDIT commands. Names containing whitespaces must be quoted for them to be recognised correctly:
SPOOL "My Report.txt"
@"My Report.sql"
Glogin, Login and Predefined Variables
The user profile files, glogin.sql and login.sql are now run after each successful connection in addition to SQL*Plus startup. This is particularly useful when the login.sql file is used to set the SQLPROMPT to the current connection details.
Three new predefined variables have been added to SQL*Plus:
- _DATE - Contains the current date or a user defined fixed string.
- _PRIVILEGE - Contains privilege level such as AS SYSDBA, AS SYSOPER or blank.
- _USER - Contains the current username (like SHOW USER).
An example of their use would be:
SET SQLPROMPT "_USER'@'_CONNECT_IDENTIFIER _PRIVILEGE _DATE> "
The values of the variables can be viewed using the DEFINE command with no parameters.
APPEND, CREATE and REPLACE extensions to SPOOL and SAVE
The following extentions have been added to the SPOOL and SAVE commands:
- REPLACE - (Default) This option replaces an existing file or creates it if it is not already present.
- CREATE - This option creates a new file or produces an error if the file already exists.
- APPEND - This option appends to an existing file, or creates a new file if it's not already present.
The following example shows their usage:
scott@db10g> spool d:\temp\test1.txt
scott@db10g> spool off
scott@db10g> spool d:\temp\test1.txt replace
scott@db10g> spool off
scott@db10g> spool d:\temp\test2.txt create
scott@db10g> spool off
scott@db10g> spool d:\temp\test2.txt create
SP2-0771: File "d:\temp\test2.txt" already exists.
Use another name or "SPOOL filename[.ext] REPLACE"
scott@db10g> spool d:\temp\test2.txt append
scott@db10g> spool off
scott@db10g> spool d:\temp\test3.txt append
scott@db10g> spool off
scott@db10g> save d:\temp\test4.sql
Created file d:\temp\test4.sql
scott@db10g> save d:\temp\test4.sql replace
Wrote file d:\temp\test4.sql
scott@db10g> save d:\temp\test4.sql create
SP2-0540: File "d:\temp\test4.sql" already exists.
Use "SAVE filename[.ext] REPLACE".
scott@db10g> save d:\temp\test5.sql create
Created file d:\temp\test5.sql
scott@db10g> save d:\temp\test5.sql append
Appended file to d:\temp\test5.sql |