Show TOC

Entering and Executing SQL StatementsLocate this document in the navigation structure

Prerequisites

  • You are logged on to the database as a database system administrator or database user.

  • You have the required privileges (see SQL Reference Manual, Privileges: Overview).

  • The database is in the ONLINE operational state.

Context

You execute SQL statements in the SQL editor.

Note

Special editors are also available for most SQL statements for the respective database objects in the SQL editor. For more information, see:

You can also enter SQL statements in graphical form (see Visual Query).

Procedure

  1. In the explorer tree, select the user who you want to execute the SQL statement.
  2. Choose SQL Editor in the context menu of the user (see SQL Editor).
  3. Enter the SQL statement.

    The following rules apply:

    • You can write SQL syntax elements in either upper or lower case.

    • You can add any number of spaces and line breaks.

    • To force the system to take into account upper/lower-case letters in database object names (such as table names), enter the name between double quotation marks: "<database_object_name>"

    • To comment out a row, use // at the start of the row.

    • To separate several SQL statements from one another, enter a commented-out separator line.

    Example

    SELECT zip, name, state

      FROM hotel.city

        WHERE name = 'Seattle'

    For more information about the syntax of SQL statements, see the SQL Reference Manual and the SQL Tutorial.

  4. To execute the SQL statement, choose Execute SQL in the context menu of the SQL editor.

Results

The result of the SQL statement is displayed.

Example

ZIP

NAME

STATE

20005

Seattle

WA

20019

Seattle

WA

20037

Seattle

WA