SUBSTR Function
Translation reference for DBMS_RANDOM.SUBSTR.
Last updated
Translation reference for DBMS_RANDOM.SUBSTR.
Last updated
This function returns
amount
bytes or characters of a LOB, starting from an absoluteoffset
from the beginning of the LOB. ()
This built-in function is replaced with Snowflake . However, there are some differences.
Oracle
Note: Result values in Oracle and Snowflake are being converted from bytes to strings for easier understanding of the function.
For Snowflake consider using:
hex_decode_string( to_varchar(SUBSTR(blob_column, 1, 6), 'HEX'));
and for Oracle consider using:
utl_raw.cast_to_varchar2(DBMS_LOB.SUBSTR(blob_column, 1, 6));
to obtain the result as a string.
Oracle
Note: UTL_RAW.CAST_TO_RAW()
is currently not being transformed to TO_BINARY()
. The function is used to show the functional equivalence of the example.
Oracle
Note: UTL_RAW.CAST_TO_RAW()
is currently not being transformed to TO_BINARY()
. The function is used to show the functional equivalence of the example.
Using DBMS_LOB.SUBSTR() on a BFILE column returns a substring of the file content.
Next example is not a current migration, but a functional example to show the differences of the SUBSTR function on BFILE types.
File Content (file.txt):
Oracle
BFILE columns are translated into VARCHAR columns, therefore applying a SUBSTR
function on the same column would return a substring of the file name, not the file content.
The current transformation for BFILE datatypes in columns is VARCHAR, where the name of the file is stored as a string. Therefore applying the SUBSTR function on a BFILE column after transformation will return a substring of the file name, while Oracle would return a substring of the file content.
: Built In Package Not Supported.
: DBMS_OUTPUT.PUTLINE check UDF implementation.