Utilities 7-25
How to Create a Command File
TheFILE statement describes the stock.unl data rows as composed of six
fields, each separated by a vertical bar (| =ASCII 124) as the delimiter.
Compare theFILE statement with the following data rows, which appear in
theinput file stock.unl. (Since the last field is not followed by a delimiter, an
error results if any data row ends with an empty field.)
1|SMT|baseball gloves|450.00|case|10 gloves/case
2|HRO|baseball|126.00|case|24/case
3|SHK|baseball bat|240.00|case|12/case
Theexample INSERT statement contains only the required elements. Since the
column list is omitted, theINSERT statement implies that values are to be
inserted into every field in thestock table. Since the VALUES clause is
omitted, the INSERT statement implies that the input values for every field
aredefined in the most-recent FILE statement. This INSERT statement is valid
because thestock table contains six fields, which is the same number of
values defined by theFILE statement.
The first data row inserted intostock from this INSERT statement is as
follows:
The following example FILE andINSERT statement set illustrates a more
complex INSERT statement syntax:
FILE stock.unl DELIMITER "|" 6;
INSERT INTO new_stock (col1, col2, col3, col5, col6)
VALUES (f01, f03, f02, f05, "autographed");
Column Value
stock_num 1
manu_code SMT
description baseball gloves
unit_price 450.00
unit case
unit_descr 10 gloves/case