Casts a VARIANT value to an OBJECT value.
AS_OBJECT( <variant_expr> )
Copy
Arguments¶variant_expr
An expression that evaluates to a value of type VARIANT.
The function returns a value of type OBJECT or NULL:
If the type of the value in the variant_expr
argument is OBJECT, the function returns a value of type OBJECT.
If the type of the value in the variant_expr
argument doesn’t match the type of the output value, the function returns NULL.
If the variant_expr
argument is NULL, the function returns NULL.
This function doesn’t support a structured type as an input argument.
Create a table and load data into it:
CREATE OR REPLACE TABLE as_object_example (object1 VARIANT); INSERT INTO as_object_example (object1) SELECT TO_VARIANT(TO_OBJECT(PARSE_JSON('{"Tree": "Pine"}')));
Copy
Use the AS_OBJECT function in a query to cast a VARIANT value to an OBJECT value:
SELECT AS_OBJECT(object1) AS object_value FROM as_object_example;
Copy
+------------------+ | OBJECT_VALUE | |------------------| | { | | "Tree": "Pine" | | } | +------------------+
RetroSearch is an open source project built by @garambo | Open a GitHub Issue
Search and Browse the WWW like it's 1997 | Search results from DuckDuckGo
HTML:
3.2
| Encoding:
UTF-8
| Version:
0.7.4