returnExtremeValue
This procedure returns the maximum/minimum incremental value in an existing table.
Parameters
Parameter | Description |
---|---|
tableName | Fully-qualified name of the data table; mandatory |
incrementalField | Field to search for the maximum/minimum value in the data table; see below for more detail |
incrementalFilter | Data table filter to search for the maximum incremental value, e.g. due to partitioning |
incrementalMinimum | If TRUE , requests the minimum value instead of the maximum one from the data table |
incrementalAlternateField | Specifies the field to return results based on the extreme value of another incremental field (e.g. to return the ID of a record with maximum/minimum timestamp, specify the ID here) |
Attributes
Attribute | Type | Description |
---|---|---|
| object | Maximum/minimum incremental value in the data table |
The extreme value is returned as an object to support multiple field types. It is supposed to be cast to the respective data type by the caller.
Please note that when the incremental field is not specified, the procedure will return no data, and thus, value assignment will always result in a null value:
SELECT count(*) FROM UTILS.returnExtremeValue (
tableName => 'SYS.Tables'
);;
This example call returns 0.
We recommend submitting only comparable column types when specifying incrementalField
. These include numbers (integer, long, float, double, decimal, etc., date, and timestamp datatypes). Submitting strings will result in an error.