HP 3000 Manuals

Putting Data into a LONG Column with an INSERT Command [ ALLBASE/SQL FORTRAN Application Programming Guide ] MPE/iX 5.0 Documentation


ALLBASE/SQL FORTRAN Application Programming Guide

Putting Data into a LONG Column with an INSERT Command 

As with any column, use the INSERT command to initially put data into a
LONG column.  At the time of the insert, all input devices must be on the
system in the locations you have specified.  Should your insert operation
fail, nothing is inserted, a relevant error message is returned to the
program, and the transaction continues.  Depending on your application,
you might want to write a verification routine that reads a portion of
each specified input device to make certain valid data exists prior to
using the INSERT command.

The next examples are based on the PartsTable created and altered in the
previous section, "Defining LONG Columns with CREATE TABLE or ALTER
TABLE." Additional examples of LONG column I/O string usage are found in
the ALLBASE/SQL Reference Manual .

Insert Using Host Variables for LONG Column I/O Strings 

When inserting a single row, use a version of the LONG Column I/O String
for each LONG column following the VALUES clause, as below.

     INSERT INTO PartsTable VALUES (
                 'bracket',
                 200,
                 :PartPictureIO,
                 :PartModuleIO)

An example of the values that might be stored in the host variables,
:PartPictureIO and :Part ModuleIO, are shown in the last two fields of a
hypothetical record in the section, Example Data File, which appears
later in this chapter.  In the above example, the values, bracket and
200, are coded as constants, rather than coming from the data file.

     bracket    200 0'<bracket.tools >bracket'      0'<mod88.module > mod88'       0

Example Data File.   

If your program reads the data from a data file, the file might look
something like this.  Note that it is limited to 80 characters per record
to facilitate documentation.

     hammer     011 0'<hammer.tools >hammer'        0'<mod11.module > mod11'       0
     file       022 0'<file.tools >file'            0'<mod22.module > mod22'       0
     saw        033 0'<saw.tools > saw'             0'<mod33.module > mod33'       0
     wrench     044 0'<wrench.tools >wrench'        0'<mod44.module > mod44'       0
     lathe      055 0'<lathe.tools >lathe'          0'<mod55.module > mod55'       0
     drill      066 0'<drill.tools >drill'          0'<mod66.module > mod66'       0
     pliers     077 0'<pliers.tools >pliers'        0'<mod77.module > mod77'       0
                 .
                 .
                 .



MPE/iX 5.0 Documentation