Entering content frame

Procedure documentation Executing an SQL Statement Locate the document in its SAP Library structure

Use

You execute an SQL statement.

Note

For an introduction to the SQL statements available, see the SQL tutorial (External). For a detailed overview of the syntax and semantics of SQL statements, see the reference manual (External).

Prerequisite

You have logged on to a database instance (Page 4).

Executing individual SQL statements in interactive mode

Enter the SQL statement.

Note

You can also enter SQL statements in multiple line mode (Page 7).

Executing several SQL statements from a batch file

You have the following options:

·        When you log on to the database instance using the call option -i <file>, enter the path and name of the batch file (Page 6) from which you want SQLCLI to read the SQL statements.

·        If you are in interactive mode, use the SQLCLI command \i <file> to enter the path and name of the batch file from which you want SQLCLI to read the SQL statements.

Example

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

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

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

select CNO,TITLE,FIRSTNAME,NAME,ZIP from 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

 

Leaving content frame