Reads Interactive SQL (dbisql) statements from a file.
READ filename [ parameter ] …
READ status.rpt '160'
READ birthday.sql [>= '1988-1-1'] [<= '1988-1-30']
[test1.sql] PARAMETERS par1, par2; BEGIN DECLARE v_par1 int; DECLARE v_par2 varchar(200); SET v_par1 = {par1}; SET v_par2 = {par2}; MESSAGE STRING('PAR1 Value: ', v_par1 ) TO CLIENT; MESSAGE STRING('PAR2 Value: ', v_par2 ) TO CLIENT; END;
(USR1)> READ test1.sql 123 '041028' PAR1 Value: 123 PAR2 Value: 041028
The READ statement reads a sequence of dbisql statements from the named file. This file can contain any valid dbisql statement, including other READ statements, which can be nested to any depth.
To find the command file, dbisql first searches the current directory, then the directories specified in the environment variable SQLPATH, then the directories specified in the environment variable PATH. If the named file has no file extension, dbisql also searches each directory for the same file name with the extension .sql.
Parameters can be listed after the name of the command file. These parameters correspond to the parameters named on the PARAMETERS statement at the beginning of the statement file (see PARAMETERS Statement ). dbisql then substitutes the corresponding parameter wherever the source file contains:
{ parameter-name }
where parameter-name is the name of the appropriate parameter.
The parameters passed to a command file can be identifiers, numbers, quoted identifiers, or strings. When quotes are used around a parameter, the quotes are put into the text during the substitution. Parameters that are not identifiers, numbers, or strings (contain spaces or tabs) must be enclosed in square brackets ([ ]). This allows for arbitrary textual substitution in the command file.
SQL character literals, including character data, passed as parameters to a READ statement should be enclosed in quotes.
If not enough parameters are passed to the command file, dbisql prompts for values for the missing parameters.
SQL—Vendor extension to ISO/ANSI SQL grammar.
Sybase—Not applicable.
None