- Categories:
Semi-structured and structured data functions (Type Predicates)
IS_DOUBLE , IS_REAL¶
Returns TRUE if its VARIANT argument contains a floating-point value, fixed-point decimal, or integer.
These functions are synonymous.
- See also:
Syntax¶
IS_DOUBLE( <variant_expr> )
IS_REAL( <variant_expr> )
Arguments¶
variant_expr
An expression that evaluates to a value of type VARIANT.
Examples¶
This shows how to use the function:
Create a table and data:
CREATE TABLE multiple_types ( array1 VARIANT, array2 VARIANT, boolean1 VARIANT, char1 VARIANT, varchar1 VARIANT, decimal1 VARIANT, double1 VARIANT, integer1 VARIANT, object1 VARIANT ); INSERT INTO multiple_types (array1, array2, boolean1, char1, varchar1, decimal1, double1, integer1, object1) SELECT TO_VARIANT(TO_ARRAY('Example')), TO_VARIANT(ARRAY_CONSTRUCT('Array-like', 'example')), TO_VARIANT(TRUE), TO_VARIANT('X'), TO_VARIANT('I am a real character'), TO_VARIANT(1.23::DECIMAL(6, 3)), TO_VARIANT(3.21::DOUBLE), TO_VARIANT(15), TO_VARIANT(TO_OBJECT(PARSE_JSON('{"Tree": "Pine"}'))) ;Now run the query:
SELECT IS_DOUBLE(double1), IS_DOUBLE(decimal1), IS_DOUBLE(integer1), IS_DOUBLE(boolean1) FROM multiple_types; +--------------------+---------------------+---------------------+---------------------+ | IS_DOUBLE(DOUBLE1) | IS_DOUBLE(DECIMAL1) | IS_DOUBLE(INTEGER1) | IS_DOUBLE(BOOLEAN1) | |--------------------+---------------------+---------------------+---------------------| | True | True | True | False | +--------------------+---------------------+---------------------+---------------------+