SQL adaptation guide for SAP Sybase ASE 16.x / Data dictionary |
IBM® Informix® and Genero support the TEXT and BYTE types to store large objects: TEXT is used to store large text data, while BYTE is used to store large binary data like images or sound.
Sybase ASE provides the TEXT and IMAGE data types for large objects storage.
The ASE driver is implemented with the Sybase Open Client Library C API. In Sybase version 16.0, this API has a limited support for LOBs, especially when it comes to update LOB data in the database: You cannot directly INSERT large LOB data, you must first INSERT nulls and then UPDATE the row with the real data. Additionally, UPDATE can only take one LOB parameter at a time. Fetching LOB data is supported, with the following limitation: LOB columns must appear at the end of the SELECT list.
TEXT and BYTE character data types are supported by the Sybase ASE database interface, with some limitation.
When INSERTing TEXT/BYTE in a table, you must first insert with nulls, the update the new row, and only with one TEXT/BYTE parameter at a time:
DEFINE ptext TEXT, pbyte BYTE ... LOCATE ptext IN ... LOCATE pbyte IN ... CREATE TABLE tab (k INT, t TEXT, b BYTE) -- First INSERT a new row with NULLs INSERT INTO tab VALUES (123,null,null) -- Then UPDATE first TEXT column UPDATE tab SET t = ptext WHERE k = 123 -- Then UPDATE second BYTE column UPDATE tab SET b = pbyte WHERE k = 123
Fetching TEXT and BYTE columns is possible as long as the columns appear at the end of the SELECT list. For example, if you have a statement such as (where pdata is a TEXT or BYTE column):
SELECT pid, pdata, ptimestamp FROM pic WHERE ...
Put the BYTE column at the end of the SELECT list:
SELECT pid, ptimestamp, pdata FROM pic WHERE ...