Procedure documentationExecuting SQL Statements Locate this document in the navigation structure

 

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

Note Note

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

End of the note.

Prerequisites

You are logged on to the database.

More information: Logging On to a Database

Procedure

Enter the SQL statement.

<sql_statement>

Example

  1. Log on to the DEMODB database as user MONA with the password RED and choose SQL mode INTERNAL:

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

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

    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

More Information

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.