Data rows that include TEXT or BYTE data do not include the TEXT or BYTE data in the row itself. Instead, the data row contains a 56-byte TEXT or BYTE data descriptor that includes a pointer to the location where the first segment of data is stored. The descriptor can point to a dbspace blobpage, a blobspace blobpage, or an optical-storage location.
You can use the DESCR() function expression to retrieve the TEXT or BYTE data descriptor for TEXT or BYTE data that is stored on WORM optical media. The DESCR() function returns the descriptor in an encoded format that is 112 bytes long. Using the DESCR() function as a column value in INSERT and UPDATE statements enables you to create additional pointers to existing TEXT and BYTE data objects on the optical media. Creating additional pointers to TEXT and BYTE data objects saves space on the optical platters by allowing multiple tables to refer to the same physical TEXT and BYTE data.
Before the TEXT or BYTE data descriptor is inserted in a data row, it is decoded and validated to verify consistency and legitimacy. The optical-storage subsystem performs all encoding, decoding, and validations through the Optical Subsystem calls to API functions. If the validation process fails, the insert operation fails.
The following example uses DESCR() in an INSERT statement to insert TEXT or BYTE data descriptors, or pointers to existing TEXT and BYTE data objects, in the following hypothetical pictures table. Assume that the picture column is a BYTE column assigned to an optical platter.
INSERT INTO pictures (stock_num, manu_code, picture) SELECT stock_num, manu_code, DESCR(cat_picture) FROM catalog WHERE manu_code = 'ANZ'
Figure 6 illustrates the result of the preceding INSERT statement for a row in the pictures table.
The following example uses DESCR() to update the pictures table with all pictures from the cat_picture column of the catalog table:
UPDATE pictures SET (picture) = (SELECT DESCR(cat_picture) FROM catalog WHERE pictures.stock_num = catalog.stock_num AND pictures.manu_code = catalog.manu_code AND cat_picture IS NOT NULL)
You can use the DESCR() function expression for TEXT or BYTE data columns that are stored on an optical platter. An error is returned if you use DESCR() on a nonoptical TEXT or BYTE data column.
Home | [ Top of Page | Previous Page | Next Page | Contents | Index ]