UNSAFE_CAST
All functions > CORE > UNSAFE_CAST
Returns the given expression casted to the given type, or raise an exception if the conversion fails.
Signatures
Returns: The expression converted to the specified type, or NULL if conversion fails
UNSAFE_CAST(expr: T, as_type: DataTypeEnum.TYPE) → U sql
| Parameter | Type | Required | Description |
|---|---|---|---|
expr | T | Yes | The expression to convert |
as_type | DataTypeEnum.TYPE | Yes | The target data type |
Notes
- Same as CAST but allowing to change or remove entity type
Examples
FeatureQL
SELECT
f1 := UNSAFE_CAST('123' AS BIGINT) -- Valid string to integer
;Result
| f1 BIGINT |
|---|
| 123 |
On this page