readtext

The readtext command provides a way to retrieve text, unitext, and image values if you want to retrieve only a selected portion of a column’s data. readtext requires the name of the table and column, the text pointer, a starting offset within the column, and the number of characters or bytes to retrieve.

The holdlock flag locks the text value for reads until the end of the transaction. Other users can read the value but cannot modify it. The at isolation clause is described in Chapter 22, “Transactions: Maintaining Data Consistency and Recovery.”

If you are using a multibyte character set, the using option allows you to choose whether you want readtext to interpret the offset and size as bytes or as characters. Both chars and characters specify characters. This option has no effect when used with a single-byte character set or with image values (readtext reads image values only on a byte-by-byte basis). If the using option is not given, readtext returns the value as if bytes were specified.

Adaptive Server must determine the number of bytes to send to the client in response to a readtext command. When the offset and size are in bytes, determining the number of bytes in the returned text is simple. When the offset and size are in characters, Adaptive Server must calculate the number of bytes being returned to the client. As a result, performance may be slower when using characters as the offset and size. using characters is useful only when Adaptive Server is using a multibyte character set. This option ensures that readtext does not return partial characters.

When using bytes as the offset, Adaptive Server may find partial characters at the beginning or end of the text data to be returned. If it does, the server replaces each partial character with question marks before returning the text to the client.

You cannot use readtext on text, unitext, and image columns in views.