Wednesday, June 12, 2013

SQL*Plus

SQL*Plus is the most basic Oracle Database utility, with a basic command-line interface, commonly used by users, administrators, and programmers.

SQL*Loader is a bulk loader utility used for moving data from external files into the Oracle database.

SQL*Loader supports various load formats, selective loading, and multi-table loads.

we can start it from  Run > sqlplusw.exe

THE MOST IMPORTANT COMMANDS AVAILABLE IN SQL * PLUS:
ACCEPT – read a variable input from the user;

DEFINE – declares a variable (DEF);

DESCRIBE – lists the attributes of the tables or other objects (DESC);

EDIT - opens an editor in which you can change the last command;

EXIT or QUIT – disconnects the user and SQL * Plus session;

GET - searches for a file in SQL and submits SQL buffer;

HOST – running an operating system command (!);

LIST - shows the last command executed SQL buffer (L);

PROMPT - displays a text on the screen;

RUN - lists and runs the command that is saved in the SQL buffer (/);

SAVE – save buffer command into a SQL script file;

SET - change environment variables specific to SQL * Plus;

SHOW - displays the environment variables settings in SQL * Plus;

SPOOL - copies the output of a command to a file;

START – run a SQL script.

THE MOST IMPORTANT SQL * PLUS SET COMMANDS
- SET RECSEP {WR [APPED] | SHE [CH] | OFF} controls the print record delimiters. The three possible values have the following meanings:
WRAPPED prints a separator after each line of a record (even if it spans multiple lines);
EACH doing the same thing, but only at the end of a record;
OFF cancels print a separator.

- SET RECSEPCHAR {_ | c} sets the character that separates the records;

- SPACE {1 | n} sets the number of spaces between the columns.

- SET WRA [P] {OFF | ON} specifies how to display records (truncated or on a line).

- SET NULL text specifies the text displayed in place of NULL value.

- HEADS [EP] {| | c | OFF | ON} specifies the characters that separate the column names of records.

- SET UND [ERLINE] {_ | c | OFF | ON the specific character used} for underlining the names of the columns.

- SET NEWP [AGE] {1 | n | NONE} sets the number of blank lines left at top of every page.

- SET TERM [OUT] {OFF | ON the display of output controls –} generated commands executed from a script.

- SET PAGES [IZE] {24 | n} specifies the number of lines displayed per page (default is 24; may be set to a value of 0 to suppress the display of column names, the title of a report).

- SET FEED [BACK] {6 | n | OFF | ON the display number} controls the record supplied as a result of a SELECT command.

- ECHO {OFF | – Controls the display ON} commands from a script launched with the START command SQL, as they are executed.

The SPOOL command allows saving the results of a query to a file specified as a parameter. She has the following syntax:

ENHANCING COMPETITIVENESS [OL] [file_name [. ext] | OFF | OUT]




For more examples 











No comments:

Post a Comment