Large Object data types LONG BINARY and BLOB

Binary Large Object (BLOB) data in Sybase IQ is stored in columns of data type LONG BINARY or BLOB.

NoteExisting LONG BINARY columns created using any Sybase IQ release prior to Sybase IQ 12.5 ESD8 are not supported. All existing LONG BINARY columns created prior to Sybase IQ 12.5 ESD8 must be explicitly dropped before installing Sybase IQ 12.6 or later versions, then recreated after installing Sybase IQ 12.6 or later versions. The ALTER DATABASE UPGRADE command does not upgrade LONG BINARY columns created prior to Sybase IQ 12.5 ESD8. For details on upgrading LONG BINARY columns, see Appendix A, “Upgrading existing LONG BINARY columns.”

LONG BINARY columns created using Sybase IQ 12.5 ESD8 or a later version do not require a special upgrade procedure. Keep in mind, however, that if the server is not licensed for the LOB component, the CREATE TABLE and ALTER TABLE ADD column commands with a LONG BINARY column are not allowed and return the error “Large Objects Management functionality is not licensed on this server.”

An individual LONG BINARY data value can have a length ranging from zero (0) to 512TB (terabytes) for an IQ page size of 128KB or 2PB (petabytes) for an IQ page size of 512KB. (The maximum length is equal to 4GB multiplied by the database page size.) The IQ database must be created with an IQ page size of at least 128KB (131072 bytes) in order to accommodate a table with LONG BINARY data.

A table or database can contain any number of LONG BINARY columns up to the supported maximum columns per table and maximum columns per database, respectively.

LONG BINARY columns can be either NULL or NOT NULL and can store zero-length values. The domain BLOB is a LONG BINARY data type that allows NULL.

A non-FP index or join index cannot be constructed on a LONG BINARY column.

A LONG BINARY column can be modified using the UPDATE, INSERT, LOAD TABLE, DELETE, TRUNCATE, SELECT...INTO and INSERT...LOCATION SQL statements. Positioned updates and deletes are not supported on LONG BINARY columns.

An Adaptive Server Enterprise IMAGE column can be inserted into a LONG BINARY column using the INSERT...LOCATION command. All IMAGE data inserted is right truncated at 32767 bytes.

Data type conversion

There are no implicit data type conversions from the LONG BINARY data type to another non-LONG BINARY data type, except to the BINARY and VARBINARY data types for INSERT and UPDATE. There are implicit conversions to LONG BINARY data type from TINYINT, SMALLINT, INTEGER, UNSIGNED INTEGER, BIGINT, UNSIGNED BIGINT, CHAR, and VARCHAR data types. There are no implicit conversions from BIT, REAL, DOUBLE, or NUMERIC data types to LONG BINARY data type.

The currently supported byte substring functions for the LONG BINARY data type are accepted as input for implicit conversion for the INSERT and UPDATE statements. See the section “Function support of LONG BINARY data type” for more information on functions that support LONG BINARY.

The LONG BINARY data type can be explicitly converted to BINARY or VARBINARY. No other explicit data type conversions (for example, using the CAST or CONVERT function) exist either to or from the LONG BINARY data type.

Truncation of LONG BINARY data during conversion of LONG BINARY to BINARY or VARBINARY is handled the same way the truncation of BINARY and VARBINARY data is handled. If the STRING_RTRUNCATION option is ON, then any right truncation (of any values, not just non-space characters) on INSERT or UPDATE of a binary column results in a truncation error and a rollback.