Getting Started with Oracle SQL*Plus

SQL*Plus is a command-line application that allows you to manage virtually every facet of the Oracle database. This article may be viewed as FAQs on SQL*Plus.

Before using SQL*Plus, there are a number of environment setting that you may want to configure. To toggle any of those settings, use the SET command shown below.

% sqlplus username
Enter Password: *****
SQL> SHOW ALL
SQL> SET {setting} ON/OFF

To turn on SQL query results to the terminal, set the following environment variable.

SQL> SET SERVEROUTPUT ON

If you expect your query to return a lot of data, use 'SET PAUSE ON' to scroll results one page at a time.

SQL > SET PAUSE ON
SQL > SET PAUSE "MORE..."

SQL*Plus stores last statement in a buffer, which may be edited or modified with the following commands:

-- List command buffer
SQL> list
-- Change old value with new to a buffered SQL statement
SQL> c/old/new
-- Append text to a buffered SQL statement
SQL> a/more text ...
-- Execute the statement stored in a buffer
SQL> /
-- To save buffered SQL statement in a file
SQL> SAVE FILE {filename}
-- To execute commands from a file
SQL> START {filename}
OR
SQL> @{filename}
Tags: 

Comments

Add new comment

Filtered HTML

  • Web page addresses and e-mail addresses turn into links automatically.
  • Allowed HTML tags: <a> <em> <strong> <cite> <blockquote> <code> <ul> <ol> <li> <dl> <dt> <dd>
  • Lines and paragraphs break automatically.

Plain text

  • No HTML tags allowed.
  • Web page addresses and e-mail addresses turn into links automatically.
  • Lines and paragraphs break automatically.