Skip to Main Content
Oracle SQL*Plus: The Definitive Guide
book

Oracle SQL*Plus: The Definitive Guide

by Jonathan Gennick
March 1999
Intermediate to advanced content levelIntermediate to advanced
528 pages
14h 39m
English
O'Reilly Media, Inc.
Content preview from Oracle SQL*Plus: The Definitive Guide

Running SQL Queries

Using SQL*Plus, you can execute any SQL query or command that you desire. This includes data manipulation commands such as INSERT, UPDATE, DELETE, and SELECT. This also includes data definition commands such as CREATE TABLE, CREATE INDEX, CREATE USER, etc. Essentially, you can execute any command listed in the Oracle SQL reference manual.

Here is an example of a simple SELECT statement against the PROJECT table:

SQL> SELECT *  /* All Columns */
 2    FROM project;

PROJECT_ID PROJECT_NAME                             PROJECT_BUDGET
---------- ---------------------------------------- --------------
      1001 Corporate Web Site                              1912000
      1002 Year 2000 Fixes                               999998000
      1003 Accounting System Implementation                 897000
      1004 Data Warehouse Maintenance                       294000
      1005 TCP/IP Implementation                            415000

Look again at the SELECT query shown above. Notice that the statement spans more than one line. Notice that it contains an embedded comment. Notice that it ends with a semicolon. All of these things are important because they illustrate the following rules for entering SQL statements:

  • SQL statements may span multiple lines.

  • Line breaks may occur anywhere SQL allows whitespace, but blank lines are not allowed.

  • Comments, delimited by /*...*/, may be embedded anywhere whitespace is allowed. A comment entered this way may span multiple lines.

  • SQL statements must be terminated in one of three ways:

    • The statement may end with a trailing semicolon.

    • The statement may end with a forward slash character, but the forward slash must be on ...

Become an O’Reilly member and get unlimited access to this title plus top books and audiobooks from O’Reilly and nearly 200 top publishers, thousands of courses curated by job role, 150+ live events each month,
and much more.
Start your free trial

You might also like

Oracle SQL*Plus: The Definitive Guide, 2nd Edition

Oracle SQL*Plus: The Definitive Guide, 2nd Edition

Jonathan Gennick
Oracle PL/SQL Programming, Third Edition

Oracle PL/SQL Programming, Third Edition

Steven Feuerstein, Bill Pribyl
Oracle SQL

Oracle SQL

Dan Hotka

Publisher Resources

ISBN: 1565925785Supplemental ContentCatalog PageErrata