FROM_BYTES
Translation specification for transforming the TO_CHAR function into an equivalent function concatenation in Snowflake
Description
The FROM_BYTES function encodes a sequence of bits into a sequence of characters representing its encoding. For more information check FROM_BYTES(Encoding).
Snowflake does not have support for FROM_BYTES function, however, some workarounds can be done for the most common occurrences of this function.
Sample Source Patterns
Teradata
SELECT
FROM_BYTES('5A1B'XB, 'base10'), --returns '23067'
FROM_BYTES('5A3F'XB, 'ASCII'), --returns 'Z\ESC '
FROM_BYTES('5A1B'XB, 'base16'); -- returns '5A1B'
Snowflake
SELECT
--returns '23067'
TO_NUMBER('5A1B', 'XXXX'),
--returns 'Z\ESC '
!!!RESOLVE EWI!!! /*** SSC-EWI-0031 - FROM_BYTES FUNCTION NOT SUPPORTED ***/!!!
FROM_BYTES(TO_BINARY('5A3F'), 'ASCII'),
TO_BINARY('5A1B', 'HEX'); -- returns '5A1B'
Known Issues
TO_NUMBER format parameter must match with the digits on the input string.
There is no functional equivalent built-in function for FROM_BYTES when encoding to ANSI
Related EWIs
SSC-EWI-0031: FUNCTION NOT SUPPORTED
Last updated