BYTE data type

The BYTE data type stores any kind of binary data in an undifferentiated byte stream. Binary data typically consists of digitized information, such as spreadsheets, program load modules, digitized voice patterns, and so on.

The term simple large object refers to an instance of a TEXT or BYTE data type. No more than 195 columns of the same table can be declared as BYTE and TEXT data types.

The BYTE data type has no maximum size. A BYTE column has a theoretical limit of 231 bytes and a practical limit that your disk capacity determines.

You cannot use the MEDIUM or HIGH options of the UPDATE STATISTICS statement to calculate distribution statistics on BYTE columns.

BYTE objects in DML operations

You can store, retrieve, update, or delete the contents of a BYTE column. You cannot, however, use BYTE operands in arithmetic or string operations, nor assign literals to BYTE columns with the SET clause of the UPDATE statement. You also cannot use BYTE objects in any of the following contexts in a SELECT statement:
  • With aggregate functions
  • With the IN clause
  • With the MATCHES or LIKE clauses
  • With the GROUP BY clause
  • With the ORDER BY clause

BYTE operands are valid in Boolean expressions only when you are testing for NULL values with the IS NULL or IS NOT NULL operators.

You can use the following methods, which can load rows or update fields, to insert BYTE data:

  • With the dbload utility
  • With the LOAD statement (DB-Access)
  • From BYTE host variables ( )

You cannot use a quoted text string, number, or any other actual value to insert or update BYTE columns.

When you select a BYTE column, you can receive all or part of it. To retrieve it all, use the regular syntax for selecting a column. You can also select any part of a BYTE column by using subscripts, as the next example, which reads the first 75 bytes of the cat_picture column associated with the catalog number 10001:
SELECT cat_picture [1,75] FROM catalog WHERE catalog_num = 10001

A built-in cast converts BYTE values to BLOB values. For more information, see the HCL OneDB™ Database Design and Implementation Guide.

If you select a BYTE column using the DB-Access Interactive Schema Editor, only the string ''<BYTE value>'' is returned; no data value is displayed.
Important: If you try to return a BYTE column from a subquery, an error results, even if the column is not used in a Boolean expression nor with an aggregate.