SUBBITSTR Function Syntax | Teradata Vantage - 17.10 - SUBBITSTR Function Syntax - Advanced SQL Engine - Teradata Database

Teradata Vantageā„¢ - SQL Functions, Expressions, and Predicates

Product
Advanced SQL Engine
Teradata Database
Release Number
17.10
Release Date
July 2021
Content Type
Programming Reference
Publication ID
B035-1145-171K
Language
English (United States)
[TD_SYSFNLIB.] SUBBITSTR ( target_arg, position_arg, num_bits_arg )

Syntax Elements

TD_SYSFNLIB.
Name of the database where the function is located.
target_arg
A numeric or variable byte expression.
If target_arg is NULL, the function returns NULL.
position_arg
An integer expression indicating the starting position of the bit substring to be extracted.
If position_arg is negative or out-of-range (meaning that it exceeds the size of target_arg), an error is returned.
If position_arg is NULL, the function returns NULL.
num_bits_arg
An integer expression indicating the length of the bit substring to be extracted. This specifies the number of bits for the function to return. Because the return value of the function is a VARBYTE string, the number of bits returned is rounded to the byte boundary greater than the number of bits requested.
The bits returned is right-justified, and the excess bits (those exceeding the requested number of bits) are filled with zeros.
If num_bits_arg is negative, or is greater than the number of bits remaining after the starting position_arg is taken into account, an error is returned.
If num_bits_arg is NULL, the function returns NULL.