position(byte[] pattern, long start) - Advanced SQL Engine - Teradata Database

SQL External Routine Programming

Product
Advanced SQL Engine
Teradata Database
Release Number
17.05
17.00
Published
June 2020
Language
English (United States)
Last Update
2021-01-24
dita:mapPath
qwr1571437338192.ditamap
dita:ditavalPath
lze1555437562152.ditaval
dita:id
B035-1147
lifecycle
previous
Product Category
Teradata Vantage™

Retrieves the byte position at which the specified byte array pattern begins within the BLOB value that this Blob object represents. The search for pattern begins at position start.

Arguments

Argument Description
pattern The byte array containing the pattern for which to search.
start The position at which to begin searching.

The first position is 1.

Return Value

If the search is successful, position() returns the position at which the pattern appears; otherwise, position returns a value of -1.

Exceptions

IF … THEN position() throws an SQLException to …
there is an error accessing the BLOB value indicate a failure while reading LOB data, setting the SQLException fields as follows:
  • SQLState Field = “TS000”
  • vendorCode Field = 7851
the value of the pattern argument is null

-or-

the value of the start argument is less than 1

indicate an invalid argument, setting the SQLException fields as follows:
  • SQLState Field = “22023”
  • vendorCode Field = 7859
the JVM cannot allocate enough memory for the method to search for the specified pattern indicate that available JVM heap memory has run out, setting the SQLException fields as follows:
  • SQLState Field = “TS000”
  • vendorCode Field = 7856