Wednesday, October 15, 2014

SQL *PLUS FORMATTING COMMANDS



SQL PLUS is most commonly used for simple queries and printed reports. Getting SQLPLUS to format information in reports according to your taste and needs requires only a handful of commands, or keywords that instruct SQL PLUS about how to behave. They are listed in table below.

SQL *PLUS Formatting Commands

Command
Definition
remark
Tells SQLPLUS that the words to follow are to be treated as comments, not instructions.
set headsep
The heading separatpr identifies the single character that tells SQLPLUS to split a title onto two or more lines.
ttitle
Sets the top title for each page of a report.
btitle
Sets the bottom title for each page of a report.
column
Gives SQLPLUS a variety of instructions on the heading, format and treatment of a column.
break on
Tells SQLPLUS where to put spaces between sections of a report or where to break for subtotals and totals.
set linesize
Sets the maximum number of characters allowed on any line of the report.
set pagesize
Sets the maximum number of lines per page.
set newpage
Sets the number of blank lines between pages.
spool
Moves a report you would normally see displayed on the screen into a file, so you can print it.
/**/
Marks the beginning and end of a comment within a SQL entry. Similar to remark.
--
Marks the beginning of an inline comment within a SQL entry. Treats everything from the mark to the end of the line as a comment. Similar to remark.
set pause
Makes screen display stop between pages of display.
save
Saves the SQL query you are creating into the file of your choice.
host
Sends any command to the host operating system.
start
Tells SQLPLUS to follow (execute) the instructions you are saved in a file.
edit
Pops you out of SQLPLUS and into an editor of your choice.
define_editor
Tells SQLPLUS the name of the editor of your choice.
 
SQL V/s SQL *PLUS
SQL
SQL*PLUS
SQL is a language for communicating with the Oracle Server to access data.
SQL *PLUS recognizes SQL statements and sends them to the server
SQL is based on American National Standards Institute (ANSI) standard SQL
SQL *PLUS is the Oracle proprietory interface for executing SQL statements
SQL manipulates data and table definitions in the database
SQL *PLUS does not allow m anipulation of values in the database
SQL is entered into the SQL buffer on one or more lines
SQL *PLUS is entered one line at a time, not stored *in the SQL buffer
SQL does not have a continuation character
SQL *PLUS uses a dash as a continuation character if the command is longer than one line
It cannot be abbreviated
It can be abbreviated
SQL uses a termination character to execute commands immediately
SQL *PLUS does not require termination characters executes commands immediately
SQL uses functions to perform some formatting
SQL *PLUS uses commands to format data

No comments: