- Categories:
AS_<object_type>¶
You can use this family of functions to perform strict casting of VARIANT values to values of other data types:
- See also:
General usage notes¶
If the type of the value in the VARIANT argument doesn’t match the output value, then NULL is returned. For example, if the AS_DATE function is passed a VARIANT value that doesn’t contain a DATE value, then NULL is returned.
If the input is NULL, the output is NULL.
Examples¶
The following examples use AS_object_type functions.
Cast values in VARIANT columns to different data types¶
Create the table and load data into it:
Query the table and cast values in the VARIANT columns to values of different data types:
Compute the average of numeric values in a VARIANT column¶
Compute the average of all numeric values from a VARIANT column in the vartab table:
Create the table and load data into it:
Show the data types of the values (some of which are numeric):
Use the AS_REAL function with the AVG function to compute the average of all numeric values
from the VARIANT column v: