Product Documentation

FairCom ISQL

Previous Topic

Next Topic

START

Syntax

ST[ART] filename [ argument ] [ ... ] ;

Description

The START statement executes the first SQL statement stored in the specified script file.

Arguments

filename

The name of the script file. ISQL reads the file until it encounters a semicolon ( ; ) statement terminator.

argument ...

ISQL substitutes the value of argument for parameter references in the script. Parameter references in a script are of the form &n, where n is an integer. ISQL replaces all occurrences of &1 in the script with the first argument value, all occurrences of &2 with the second argument value, and so on. The value of argument must not contain spaces or other special characters.

Notes

  • In addition to executing the first statement in the script file, the START statement appends the statement (after any argument substitution) to the history buffer.
  • The GET, START, and @ (execute) statements are similar in that they all read SQL script files. Both GET and START read an SQL script file and append the first statement in it to the history buffer. However, the START statement also executes the script statement and accepts arguments that it substitutes for parameter references in the script statement. The @ (execute) statement, on the other hand, executes all the statements in an SQL script file but does not add any of the statements to the history buffer. The @ statement does not support argument substitution.

Example


ISQL> -- Nothing in history buffer:

ISQL> history

History queue is empty.

ISQL> -- Display a script file with the ! shell statement. The script's SQL ISQL> -- statement uses the LIKE predicate to retrieve customer names

ISQL> -- beginning with the string passed as an argument in a START statement:

ISQL> ! more start_ex.sql

SELECT customer_name FROM customers

WHERE customer_name LIKE '&1%';

ISQL> -- Use the START statement to execute the SQL statement in the script

ISQL> -- start_ex.sql. Supply the value 'Ship' as a substitution argument:

ISQL> START start_ex.sql Ship

CUSTOMER_NAME

-------------

Ship Shapers Inc.

1 record selected

ISQL> -- ISQL puts the script statement, after argument substitution,

ISQL> -- in the history buffer:

ISQL> history

1 ! more start_ex.sql

3 START start_ex.sql Ship

4 SELECT customer_name FROM customers

WHERE customer_name LIKE 'Ship%'


TOCIndex