What is the difference between @ and @@?
The @ (at symbol) is equivalent to the START command and is used to run SQL*Plus command scripts.
SQL> @myscript.sql
A single @ symbol runs a script in the current directory (or one specified with a full or relative path, or one that is found in your SQLPATH or ORACLE_PATH).
@@ will start a sqlplus script that is in the same directory as the script that called it (relative to the directory of the current script).
What is the difference between & and &&?
“&” is used to create a temporary substitution variable that will prompt you for a value every time it is referenced.
“&&” is used to create a permanent substitution variable. Once you have entered a value (defined the variable) its value will used every time the variable is referenced.
What is the difference between ! and HOST?
Both “!” and “HOST” will execute operating system commands as child processes of SQL*Plus. The difference is that “HOST” will perform variable substitution (& and && symbols), whereas “!” will not.
Note: use “$” under OS/390, VMS, and Windows environments, not “!”.
How does one trap errors in SQL*Plus?
Use the “WHENEVER SQLERROR …” command to trap SQL and PL/SQL errors, and the “WHENEVER OSERROR …” to trap operating system errors. Eg:
SQL> WHENEVER OSERROR EXIT 9 SQL> WHENEVER SQLERROR EXIT SQL.SQLCODECan one pass operating system parameters to SQL*Plus?
One can pass operating system variables to sqlplus using this syntax:sqlplus username/password @cmdfile.sql var1 var2 var3Parameter var1 will be mapped to SQL*Plus variable &1, var2 to &2, etc. Look at this example:
sqlplus scott/tiger @x.sql '"test parameter"' dualWhere x.sql consists of:
select '&1' from &2; exit 5;Example passing the Windows User's Temp Path Location to sqlplus:
sqlplus username/password @cmdfile.sql %TEMP%within @cmdfile.sql -
SPOOL &1\myscript.log -- Your script commands SPOOL OFFCan one generate HTML reports from SQL*Plus?
set markup HTML onspool index.html select * from tab; spool off set markup HTML off