Conversion Functions
# StreamSQL Conversion Functions
Conversion functions are used for data type conversion.
# Basic Conversion Functions
# CAST - Type Conversion Function
Syntax: cast(value as type)
Description: Converts a value to the specified type.
# HEX2DEC - Hex to Decimal Function
Syntax: hex2dec(hex_str)
Description: Converts a hexadecimal string to a decimal number.
# DEC2HEX - Decimal to Hex Function
Syntax: dec2hex(number)
Description: Converts a decimal number to a hexadecimal string.
# Encoding Conversion Functions
# ENCODE - Encoding Function
Syntax: encode(str, encoding)
Description: Encodes a string according to the specified encoding.
# DECODE - Decoding Function
Syntax: decode(str, encoding)
Description: Decodes a string according to the specified encoding.
# URL_ENCODE - URL Encoding Function
Syntax: url_encode(str)
Description: Performs URL encoding on a string.
# URL_DECODE - URL Decoding Function
Syntax: url_decode(str)
Description: Performs URL decoding on a string.
# Time Conversion Functions
# CONVERT_TZ - Timezone Conversion Function
Syntax: convert_tz(datetime, from_tz, to_tz)
Description: Converts datetime from one timezone to another.
# TO_SECONDS - Convert to Seconds Function
Syntax: to_seconds(datetime)
Description: Converts datetime to seconds.
# Other Conversion Functions
# CHR - Character Function
Syntax: chr(number)
Description: Converts an ASCII code to a character.
# TRUNC - Truncate Function
Syntax: trunc(number, [precision])
Description: Truncates a number to the specified precision.
# 📚 Related Documentation
- String Functions - Learn detailed usage of string functions
- DateTime Functions - Learn detailed usage of datetime functions
- SQL Reference - View complete SQL syntax reference