Oracle7 Administrator's Reference for UNIX

Contents Index Home Previous Next

Using SQL*Plus

Loading and Running Demonstrations

Demonstration tables can be loaded automatically when you install SQL*Plus. You can also load the demonstration tables manually.

You do not have to log in as SYSTEM/password to load a demonstration. You can load a demonstration from within a session, after which the session terminates.

To load the demonstration, enter:

$ cd $ORACLE_HOME/sqlplus/demo
$ sqlplus scott/tiger @demobld

To delete the demonstration tables, enter:

$ cd $ORACLE_HOME/sqlplus/demo
$ sqlplus scott/tiger @demodrop

Using a System Editor from SQL*Plus

An ed or edit command entered at the SQL*Plus prompt calls a default operating system editor, such as ed, emacs, ned, or vi. Your PATH variable must include the directory of the editor.

The global default editor is usually set by the DBA in glogin.sql using the SQL*Plus _editor option. Override this setting by specifying an editor in login.sql. Both files are read by SQL*Plus at startup, the local file taking precedence. The _editor option can also be set during a SQL*Plus session, overriding the setting in either file.

If the _editor option is not set, the EDITOR and VISUAL environment variables specify the SQL*Plus editor. These variables are not set in glogin.sql or login.sql. They are set in a user startup file, or at the system prompt. If both are set, the EDITOR variable is used.

Setting the Order of the Editor

SQL*Plus searches for the default editor in the following order:

If none of these values are set, SQL*Plus uses ed.

Setting the _editor option

Set the SQL*Plus _editor option by adding the following line to the login.sql file:

define _editor=editor_name

where editor_name is a UNIX editor.

Setting Environment Variables

Set the default editor with an environment variable by entering:

For the Bourne or Korn shell:

$ UNIX_VAR=editor_name; export UNIX_VAR

For the C shell:

% setenv UNIX_VAR editor_name

where:

UNIX_VAR is the EDITOR or VISUAL environment variable
editor_name is the UNIX editor

Default Settings

If you call the system editor, the current SQL buffer is placed in the edit buffer and all statements available to the editor can change the SQL statement. SQL*Plus uses the afiedt.buf. temporary file. When you exit the editor, the changed SQL buffer is returned to SQL*Plus.

Running Operating System Commands from SQL*Plus

An exclamation point (!) in the first position after the SQL*Plus prompt indicates subsequent character strings are passed to a sub-shell. The SHELL environment variable selects the shell you use to execute operating system commands. The default shell is /bin/sh (sh). If the shell cannot be executed, an error message appears.

Use the following SQL*Plus commands to perform specific tasks:

Interrupting SQL*Plus

While running SQL*Plus:

Using the SPOOL Command

The default filename extension for files generated by the SPOOL command is .lst. To change the extension, specify a spool file containing a period (.). For example, enter:

SQL> SPOOL query.lis


Contents Index Home Previous Next