2.5 Entering and Executing Commands

Use the following commands to execute and collect timing statistics on SQL commands and PL/SQL blocks:

/ (slash)

Executes the most recently executed SQL command or PL/SQL block which is stored in the SQL buffer. Does not list the command. Use slash (/) at the command prompt or line number prompt in SQLcl command line.

EXEC[UTE] statement

Executes a single PL/SQL statement or runs a stored procedure.

R[UN]

Lists and executes the most recently executed SQLcl command or PL/SQL block which is stored in the SQL buffer. The buffer has no command history list and does not record SQLcl commands.

TIMI[NG]

Timing is only available as a switch.

Use the following command to access the help system:

HELP | ? [topic]

Accesses the command-line help system. Enter HELP INDEX or ? INDEX for a list of topics. You can view the Oracle Database Library at http://www.oracle.com/technology/documentation.

Use the following command to execute operating system commands:

HO[ST] [command]

Executes an operating system command without leaving SQLcl. Enter HOST without command to display an operating system prompt. You can then enter multiple operating system commands.

With some operating systems, you can use another character instead of HOST such as "!" (UNIX) and "$" (Windows). See the Oracle installation and user's manuals provided for your operating system for details.

You can use the _RC variable to return the exit status of the command executed with HOST.

Note:

When connecting to a database using bequeath protocol (where a client connection is passed directly to a dedicated server process without going through the listener), the _RC variable is not automatically updated. Set bequeath_detach=yes in the sqlnet.ora configuration file to update the _RC variable.

Use the following command to recall the history of SQLcl commands:

HISTORY [index | FULL | USAGE | SCRIPT | TIME | CLEAR (SESSION)?] | FAILS

  • Use the Up and Down arrow keys to navigate through history items at the prompt.

  • Use the HISTORY command to print the history contents.

  • History is limited to the last 100 statements.

  • SET HISTORY LIMIT N allows you to change the default limit, where N is the maximum number.

  • History is retained between SQLcl sessions.

  • By default, the SHOW, HISTORY, CONNECT, and SET commands are not saved in history.

  • SET HISTORY FILTER allows you to set the commands that should not be recorded in history.