Executing SQL Statements

Use

You execute an SQL statement in interactive mode (session mode).

For information about the other options for executing SQL statements in the SQLCLI, see Executing Commands.

Prerequisites

You are logged on to a database instance.

Procedure

Enter the SQL statement <sql_statement>.

<sql_statement>

Example

Logging on to the database instance DEMODB as user MONA with the password RED and defining the SQL mode INTERNAL

sqlcli -d DEMODB -u MONA,RED -S INTERNAL

Displaying the CNO, TITLE, FIRSTNAME, NAME, and ZIP columns of the HOTEL.CUSTOMER table:

select CNO,TITLE,FIRSTNAME,NAME,ZIP from HOTEL.CUSTOMER

CNO    | TITLE   | FIRSTNAME  | NAME       | ZIP
-------+---------+------------+------------+------
  3000 | Mrs     | Jenny      | Porter     | 10580
  3100 | Mr      | Peter      | Brown      | 48226
  3200 | Company | ?          | Datasoft   | 90018
  3300 | Mrs     | Rose       | Brian      | 75243
  3400 | Mrs     | Mary       | Griffith   | 20005
  3500 | Mr      | Martin     | Randolph   | 60615
  3600 | Mrs     | Sally      | Smith      | 75243
  3700 | Mr      | Mike       | Jackson    | 45211
  3800 | Mrs     | Rita       | Doe        | 97213
  3900 | Mr      | George     | Howe       | 75243
  4000 | Mr      | Frank      | Miller     | 95054
  4100 | Mrs     | Susan      | Baker      | 90018
  4200 | Mr      | Joseph     | Peters     | 92714
  4300 | Company | ?          | TOOLware   | 20019
  4400 | Mr      | Antony     | Jenkins    | 20903
(15 rows selected)
* Ok

See also:

Executing Database Procedures

For an introduction to the SQL statements available, see the SQL Tutorial. For a detailed overview of the syntax and semantics of SQL statements, see the SQL Reference Manual.