Name
aref — returns specific element of an array or string
Synopsis
aref
( |
arg any , |
nth integer ) ; |
Description
aref
returns the nth
element of an array , string or
string_session , where nth
is a zero-based index. If the
first argument is a string or
string_session , the integer ASCII value of the nth
character is returned. If the
first argument is an array of any , then
the corresponding element is returned.
Parameters
arg
array , vector or string .
nth
integer zero-based index.
Return Values
An integer character code or
nth
element as whatever
type the element is if arg
is an array or vector (heterogeneous array.)
Errors
Table24.2.Errors signalled by aref
SQLState | Error Code | Error Text | Description |
---|---|---|---|
22003 | SR017 | aref: Bad array subscript (zero-based) %d for an arg of type %s (%d) and length %d. | |
22023 | SR000 | aref expects an array or vector, not an arg of type %d. |
Examples
Example24.13.Simple examples
SQL> select aref ('Abacus', 0); callret VARCHAR _______________________________________________________________________________ 65 1 Rows. -- 3 msec. SQL> select aref (vector ('Primero', 2, 3.333), 2); callret VARCHAR _______________________________________________________________________________ 3.333 1 Rows. -- 4 msec. SQL>