ALLBASE/SQL Reference Manual (36216-90216)

Chapter 7 223
Data Types
Long Operations
Using INSERT with No Specified File Options
In this example, data from the file hammer.tools becomes the contents of the LONG
column PartPicture. The output device is the file hammer. If this file already exists when
the SELECT or FETCH statement is issued, it is not overwritten or appended to, and an error
is generated.
INSERT INTO PurchDB.PartsIllus
VALUES ('hammer'
100,
'<hammer.tools >hammer')
Using INSERT with the Overwrite Option
When you want to reuse an existing output device file when the inserted data is later
selected or fetched, specify the overwrite option. Here if file wrench already exists at
INSERT time, it is overwritten:
INSERT INTO PurchDB.PartsIllus
VALUES ('hammer',
100,
'<hammer.tools >!wrench')
Using INSERT with the Append Option
You can append LONG data to an existing file. If the file limit for the wrench files is
inadequate to hold the data that is to be appended, a warning is returned (DBWARN
2051), but data up to the file limit is added to the file. In this example, when the LONG
column PartPicture is selected or fetched, output is appended at the end of the file wrench:
INSERT INTO PurchDB.PartsIllus
VALUES ('hammer',
100,
'<hammer.tools >>wrench')
Using INSERT with the Wildcard Option
Depending on your application, you may need to assign a specific, known name to the
output device. On the other hand, a partially generic name or a completely unknown name
may be desirable. In this example, the output device name begins with PRT and is followed
by a five-character, random wild card, for instance, 'PRT123AB':
INSERT INTO PurchDB.PartsIllus
VALUES ('hammer'
100,
'< hammer.tools >PRT$')