ALLBASE/SQL Reference Manual (36216-90216)

222 Chapter7
Data Types
Long Operations
The next statement specifies that data for the new LONG column, PartModule, will be
stored in PartPictureSet:
ALTER TABLE PurchDB.PartsIllus
ADD PartModule LONG VARBINARY(50000) IN PartPictureSet
Since LONG data for PartMap will be stored in the same DBEFileSet as its related table,
PartsIllus, it goes to PartsIllusSet.
ALTER TABLE PurchDB.PartsIllus
ADD PartMap LONG VARBINARY(70000)
Defining Input and Output with the LONG Column I/O String
The INSERT and UPDATE statements use the LONG column I/O string to define the
various input and output parameters for any LONG column. You need to understand this
string in order to input, change, or retrieve LONG data.
The LONG column I/O string has an input portion (indicated with <) and an output
portion (indicated with >). The input portion of the LONG column I/O string, also referred
to as the input device, specifies the location of data that you want written to the
database. You can indicate a file name or a heap address and heap length.
A variable length record file cannot be input to a LONG column.
The output portion of the LONG column I/O string (the output device) specifies where
you want LONG data to be placed when you execute the SELECT or FETCH statement. You
have the option of specifying a file name, part of a file name, or having ALLBASE/SQL
specify a file name. You also can direct output to the heap address (in this case,
ALLBASE/SQL will select the heap address). Additional output parameters allow you to
append to or overwrite an existing file. The output device specification is stored in the
database table and is available to you when you use the OUTPUT_DEVICE function or
OUTPUT_NAME function together with a SELECT or FETCH statement. For more
information on the OUTPUT_DEVICE and OUTPUT_NAME functions, see Chapter 8 ,
“Expressions,” in this document.
The examples in the following sections illustrate the use of the input and output portions
of the LONG column I/O string. The complete syntax for the LONG column I/O string is
presented under the INSERT, UPDATE, and UPDATE WHERE CURRENT statements.
It is important to note that files used for LONG column input and output are opened and
closed by ALLBASE/SQL. You do not need to open or close the files for use in the
DBEnvironment. ALLBASE/SQL does not control the input or output device files on the
operating system. That is, if there is a rollback work, ALLBASE/SQL will not remove the
physical operating system file generated by the SELECT statement.
Using INSERT with LONG Column Data
As with any column, you use the SQL INSERT statement or an ISQL INPUT command to
initially put data in a LONG column. The LONG column I/O string requires an input
device, but the output device is optional.
The following examples illustrate some of the options available to you.