Type conversions
Convert values explicitly and handle nulls.
Example
Section titled “Example”SELECT CAST('42' AS BIGINT) AS value;SELECT CAST(42 AS TEXT) AS label;SELECT CAST(NULL AS BIGINT) AS missing;Behavior
Section titled “Behavior”A cast can fail if the input cannot be represented by the destination type. Validate untrusted input and handle conversion errors instead of relying on silent truncation. SQL NULL remains NULL when cast.
Related
Section titled “Related”This site uses Google Analytics cookies to count visits. Privacy · License