Sunday, December 2, 2012

0 SQL* Plus commands

Here are some of notes for the SQL*Plus command

show all: List all the SQL*Plus environment variables and settings.

show all


! and host : Execute the OS command

Both ! and host can execute the OS command, such as ls/dir. However, the ! only works on Linux  and host works on both.

Here is the screenshot from Linux:


Here is the screenshot from Windows: The OS version is Win7 with  SQL*Plus 11.2


@ : Execute the SQL Script


edit : open the default editor

edit would open the default editor to with the last query in the buffer. The default editor usually is VI on Linux, notepad on windows.


The default editor is defined through define_editor



/  and run : Re execute the last command

/ and run  would re execute the last command. The difference is run would show the SQL statement.



Spool can output the result of the query to another files. The standard output result would not be suppress. If the file already exist, it would be overwritten.


set termout off/on

From command name itself, it seems to suppress all the terminal output, but it actually suppress the terminal output ONLY if you execute the script.

Here is the demo:

I set the termout off, but the output still to the standard out.


Lets create the test.sql with the same query.

When I execute the @C:\test.sql, the output does not show up on the standard out due to the termout is off. After I change to termout to on, @C:\test.sql would return the output to standard out.



Post a Comment


SQL Panda Copyright © 2011 - |- Template created by O Pregador - |- Powered by Blogger Templates