Hitachi

Hitachi Advanced Database Command Reference


38.3.1 Executing an SQL statement from the standard input

This example executes a SELECT statement to search table T1.

  1. Start the adbsql command.

    adbsql

    If the -u option (authorization identifier) is specified in the command, step 2 is skipped and step 3 is performed. If the -u option (authorization identifier) and the -p option (password) are both specified in the command, steps 2 and 3 are skipped and step 4 is performed.

  2. Enter the authorization identifier as the response to the input request.

    USER-ID ?
    ADBUSER01

    Specify the authorization identifier of an HADB user who has the CONNECT privilege and who has the SELECT privilege for table T1, and then press the Enter key. The authorization identifier entered here is used to connect to the HADB server.

  3. Enter the password.

    PASSWORD ?

    Specify the password for the authorization identifier of the HADB user that connects to the HADB server, and then press the Enter key. The entered characters are not displayed.

  4. Execute the SELECT statement.

    COMMAND ?     +----2----+----3----+----4----+----5----+----6----+----7----+
    SELECT 'C1 = ',"C1" FROM "T1";                        ...1
     EXP0001_NO_NAME C1                                   ...2
     --------------- ----------------
               C1 =   -123456789.1234
               C1 =  ****************
    KFAA96404-I 2 rows were selected.
    Explanation:

    1. This is the SELECT statement that is to be executed. Specify a semicolon (;) at the end of the SQL statement.

    2. This line and below are the execution results of the SELECT statement. For the display format of SQL statement execution results, see 38.7 Output format of SQL statement execution results.

  5. Terminate the adbsql command.

    COMMAND ?     +----2----+----3----+----4----+----5----+----6----+----7----+
    #EXIT;

    Execute the adbsql command's #EXIT subcommand to terminate the adbsql command.

About the prompts that are displayed

The prompts explained in the following table are displayed as you execute the adbsql command.

Table 38‒1: Prompts that are displayed for the SQL statement or adbsql subcommand entry window

No.

Prompt that is displayed

Description

1

USER-ID ?

Waiting for entry of the authorization identifier that is needed to connect to the HADB server. This prompt is displayed after the adbsql command or the adbsql command's #CONNECT subcommand has executed. Note that if the -u option is specified in the adbsql command that is executed, this prompt is not displayed.

For the authorization identifier, you can specify a character string of 1 to 100 bytes. Note that the byte count (1 to 100 bytes) does not include the double quotation marks used to enclose the authorization identifier.

If no authorization identifier is entered when its entry is requested, ADBUSER is assumed to be the authorization identifier.

2

PASSWORD ?

Waiting for entry of the password. If the -u and -p options are specified in the adbsql command that is executed, this prompt is not displayed.

The character string for the entered password is not displayed.

For the password, you can specify a character string of 1 to 255 bytes. The password cannot be omitted.

3

COMMAND ?

Normal entry wait status.

4

NEXT ?

Waiting for entry of a continuation line.

If the Enter key is pressed before entry of a semicolon (;), indicating the end of the SQL statement or adbsql subcommand, that line is treated as a line to be continued on a continuation line (that is, the entry of the SQL statement or adbsql subcommand has not been completed). When this prompt is displayed, enter the remainder of the SQL statement or of the adbsql subcommand.

5

DATA(n) ?

Waiting for the data for a dynamic parameter. When COMMAND ? is displayed after this prompt, enter the data for the dynamic parameter.