SQL*Plus

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

Command types

SQL*Plus understands five categories of text:[1]

  1. SQL statements
  2. PL/SQL blocks
  3. SQL*Plus internal commands, for example:
    • environment control commands such as SET
    • environment monitoring commands such as SHOW
  4. Comments
  5. External commands prefixed by the ! char

Scripts can include all of these components.

An Oracle programmer in the appropriately configured software environment can launch SQL*Plus, for example, by entering:

$ sqlplus scott/tiger

where the Oracle user scott has the password tiger. SQL*Plus then presents a prompt with the default form of:

SQL>

Interactive use can then start by entering a SQL statement (terminated by a semicolon), a PL/SQL block, or another command. For example:

SQL> select 'Hello world' as example from dual;

EXAMPLE
--------------------------------
Hello world

History

The first version of SQL*Plus was called UFI ("User Friendly Interface"). UFI appeared in Oracle database releases up to Version 4.

After Oracle programmers had added new features to UFI, its name became Advanced UFI. The name "Advanced UFI" changed to "SQL*Plus" with the release of the version 5 of Oracle.[2]

Usage

Graphical interfaces from Oracle or third parties have diminished the proportion of Oracle database end-users who depend on the SQL*Plus environment. Oracle shops typically continue to use SQL*Plus scripts for batch updating or simple reports.

Oracle Corporation's wrappers/gui-fications/replacements for SQL*Plus include:

Oracle 11g

Starting from Oracle database 11g, iSqlplus (web based) and sqlplus GUI no longer ship with Oracle database software.[7] The command-line SQL*Plus interface continues in use, mostly for non-interactive scripting or for administrative purposes. The Server Manager Command Line -a replacement of SQL*DBA- is obsolete and SQL*plus 8i and later allows the user to issue statements like STARTUP and SHUTDOWN when connected as SYSDBA. Server Manager 7.1 introduced the command CONNECT / AS SYSDBA to replace CONNECT INTERNAL.[8] SQL*plus 8i and later allows the use of CONNECT / AS SYSDBA

Compatibility

Other vendors have made their software somewhat compatible with SQL*Plus script commands or offer a SQL*Plus mode of operation. Relevant products include TOAD from Quest Software.

Integration

Variables

SQL*Plus-internal variables, accessible within an SQL*Plus session, include:

Error trapping

The WHENEVER command specifies an action to perform in the event of the system detecting an SQL error[12] or an operating-system error[13] while running a subsequent SQL*Plus command.

Supplementary software

See also

References

  1. "SQL*Plus at orafaq.com". Archived from the original on 2007-11-09. Retrieved 2007-11-26.
  2. Oracle Insights (1st ed.). 2004. p. 35. ISBN 978-1590593875. Retrieved March 18, 2014.
  3. Evans, Robert (2008-10-01). "The SQL*Plus Worksheet". Cardiff University. Retrieved 2008-11-21. Oracle's SQL*Plus Worksheet is a straight-forward, easy-to-use, graphical user interface for SQL.
  4. "ISQLPlus". Oracle FAQ. 2008-02-29. Retrieved 2008-11-21. iSQLPlus (iSQL*Plus) is a web-based utility similar to the SQL*Plus command line utility for executing SQL and PL/SQL commands (available up to Oracle 10gR2).
  5. "Oracle SQL Developer 1.5: Feature List". Oracle Corporation. Retrieved 2008-11-21. The SQL*Plus commands supported by Oracle SQL Developer SQL Worksheet are listed [...]
  6. "Oracle Application Express". Oracle Corporation. Retrieved 2008-11-21. SQL Workshop provides tools to enable you to view and manage database objects from a Web browser. Use SQL Commands to run SQL and PL/SQL statements. ...
  7. Deprecated Components in Oracle Database 11g Release 1 (11.1), retrieve by 25-Jun-2009
  8. Oracle 7 doc, 1994
  9. Alapati, Sam R. (2008). "4". Expert Oracle Database 11g Administration. Apress. pp. 118–119. ISBN 978-1-4302-1015-3. Retrieved 2009-07-29.
  10. Roshak, Natalka (2005-11-06). "Spice up your SQL Scripts with Variables". Oracle FAQ. Retrieved 2009-07-29. & and && indicate substitution variables in SQL*Plus scripts or commands.
  11. Nyffenegger, René. "Using bind variables in SQL*Plus". René Nyffenegger's collection of things on the web. Retrieved 2009-07-29. In SQL*Plus, a bind variable is declared with variable [...] The value of the bind variable can then be printed with print
  12. Watt, Simon. "SQL*Plus User's Guide and Reference". Oracle Help Center. Oracle Database Online Documentation, 10g Release 2 (10.2) / Administration. Oracle. p. 74. Retrieved 2015-11-04. WHENEVER SQLERROR [...] [d]irects SQL*Plus to perform the specified action as soon as it detects a SQL command or PL/SQL block error (but after printing the error message).
  13. Watt, Simon. "SQL*Plus User's Guide and Reference". Oracle Help Center. Oracle Database Online Documentation, 10g Release 2 (10.2) / Administration. Oracle. p. 73. Retrieved 2015-11-04. WHENEVER OSERROR [...] [d]irects SQL*Plus to perform the specified action as soon as an operating system error is detected.

External links

This article is issued from Wikipedia - version of the Thursday, November 05, 2015. The text is available under the Creative Commons Attribution/Share Alike but additional terms may apply for the media files.