17.10 - getBytes(long pos, int length) - Advanced SQL Engine - Teradata Database

Teradata Vantage™ - SQL External Routine Programming

Product
Advanced SQL Engine
Teradata Database
Release Number
17.10
Release Date
July 2021
Content Type
Programming Reference
Publication ID
B035-1147-171K
Language
English (United States)

Retrieves all or part of the BLOB value that this Blob object represents as an array of bytes.

The result byte array contains up to length consecutive bytes from the BLOB value designated by this Blob object, starting with the byte at position pos.

If pos + length - 1 is larger than the length of the BLOB in bytes, the length of the resulting byte array is less than length.

Syntax

getBytes(long pos, int length)

Syntax Elements

pos
The ordinal position of the first byte in the BLOB value to be extracted.
The first byte is at position 1.
length
The number of consecutive bytes to be copied.

Exceptions

IF … THEN getBytes() throws an SQLException to …
there is an error accessing the BLOB value indicate an unexpected failure while reading LOB data, setting the SQLException fields as follows:
  • SQLState Field = “TS000”
  • vendorCode Field = 7851
the value of the pos argument is less than 1

-or-

the value of the length argument is negative

indicate an invalid argument, setting the SQLException fields as follows:
  • SQLState Field = “22023”
  • vendorCode Field = 7859
the value of the length argument is too large for the current JVM to allocate the required memory in this method indicate that JVM heap memory has run out, setting the SQLException fields as follows:
  • SQLState Field = “TS000”
  • vendorCode Field = 7856