UNSAFE_CAST()
All functions > CORE > UNSAFE_CAST()
Returns the given expression casted to the given type, allowing to change or remove entity type
Signatures
Returns: The expression converted to the specified type, or NULL if conversion fails
UNSAFE_CAST( expr AS type ) → U sql
| Parameter | Type | Required | Description |
|---|---|---|---|
expr | T | Yes | The expression to convert |
type | TYPE | Yes | Target type; may change or remove the entity annotation |
Notes
- Same as CAST but allowing to change or remove entity type
See also
Examples
Typical casts
FeatureQL
RETURN
-- Valid string to integer
f1 := UNSAFE_CAST('123' AS BIGINT),
-- Double truncates toward zero
f2 := UNSAFE_CAST(3.14e0 AS BIGINT),
-- String to DATE
f3 := UNSAFE_CAST('2024-06-01' AS DATE)
;Result
| f1 BIGINT | f2 BIGINT | f3 TIMESTAMP |
|---|---|---|
| 123 | 3 | 2024-06-01 |
On this page