HPlogo ALLBASE/SQL Pascal Application Programming Guide: HP 9000 Computer Systems > Chapter 12 Programming with LONG Columns

Putting Data into a LONG Column with a INSERT Command

» 

Technical documentation

Complete book in PDF
» Feedback

 » Table of Contents

 » Index

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 below. In the above example, the values, bracket and 200, are coded as constants, rather than coming from the data file. Your data file might look like this (note that each item is limited to 80 characters per record to facilitate documentation):

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

hammer     011 0'<../tools/hammer >hammer'     0'<../module/mod11 > mod11'    0

file       022 0'<../tools/file >file'         0'<../module/mod22 > mod22'    0

saw        033 0'<../tools/saw > saw'          0'<../module/mod33 > mod33'    0 

wrench     044 0'<../tools/wrench >wrench'     0'<../module/mod44 > mod44'    0

lathe      055 0'<../tools/lathe >lathe'       0'<../module/mod55 > mod55'    0

drill      066 0'<../tools/drill >drill'       0'<../module/mod66 > mod66'    0 

pliers     077 0'<../tools/pliers >pliers'     0'<../module/mod77 > mod77'    0

            .

            .

            .
Feedback to webmaster