Running SQL commands

Running SQL commands with the SQL interactive interface.

Procedure

Starting the interface.

  • Use the following command to start the interface:

    For Linux operating systemFor UNIX operating system$NCHOME/omnibus/bin/nco_sql -server ObjectServer_name -user user_name -password password

    If you do not specify an ObjectServer name, the default name NCOMS is used. If you do not specify a user name, the default is the user running the command. If you do not use the -password option, you are prompted for a password.

    For Windows operating system%NCHOME%\omnibus\bin\isql -S ObjectServer_name -U user_name -P password

    You must specify an ObjectServer name and user name. You must also include the -P option, even when you use an empty password string (as when connecting to the default NCOMS ObjectServer).

    Note: The password is visible on the command line.
    When the interface starts, a numbered prompt is displayed. The prompt looks like this:
    1>

Issuing commands.

  • To issue a command using the interface:
    1. Enter your command at the prompt and press Enter.
    2. Enter the keyword go (in lowercase letters) and press Enter.
    The interface has the following characteristics:
    • Commands have a limit of 4094 characters per line. If you need to use a longer command, you can split it over several lines or use the default editor to issue the command.
    • You can enter multiple commands separated by semicolons (;) and run them all with a single go command.
    • You can split a single command over several lines.
    • To cancel a command, enter the reset command at the beginning of a new line, or press Ctrl+C anywhere on a line.

      Any commands that have not been run are discarded.

    • For Windows operating systemWhen specifying directory paths (as required by some SQL commands), use an additional backslash character (\) to escape each directory separator. For example:

      create file file_name 'c:\\temp\\file_name.txt';

      The interface will also accept UNIX-style paths on Windows systems. For example:

      create file file_name 'c:/temp/file_name';

    • To run an operating system command, enter !!, followed by the command, at the beginning of a new line.

      For example: !!ls

    • For Linux operating systemFor UNIX operating systemTo run the default editor (as defined by the EDITOR environment variable), enter vi at the beginning of a new line.
    • For Linux operating systemFor UNIX operating systemnco_sql does not allow whitespace before the go keyword.

Shutting down the interface.

  • To shut down the interface, enter quit or exit at the beginning of a new line.

    For Linux operating systemFor UNIX operating systemYou can also press Ctrl+D to shut down the interface.