Usage Notes | OPRIOR | Teradata Vantage - 17.10 - Usage Notes - Advanced SQL Engine - Teradata Database

Teradata Vantageā„¢ - Data Types and Literals

Advanced SQL Engine
Teradata Database
Release Number
Release Date
July 2021
Content Type
Programming Reference
Publication ID
English (United States)

OPRIOR takes an array expression as an argument and returns the subscript of the element prior to the element specified by integer_value or array_bound, if that element is currently populated. If you specify an element subscript that is less than or equal to the value of OFIRST for the array, a NULL is returned. Also, if integer_value or array_bound is NULL, an error is returned.

If array_expr is a one-dimensional ARRAY type, OPRIOR returns an unsigned INTEGER value. If array_expr is a multidimensional ARRAY type, OPRIOR returns a new instance of the predefined ARRAY type ArrayVec, containing the subscript information. If the array is empty (all elements of the array are in an uninitialized state), then OPRIOR returns NULL.

If array_expr is NULL, an error is returned.

The OPRIOR method with one INTEGER argument is compatible with the Oracle PRIOR method for one-dimensional ARRAY types.