SSC-EWI-OR0105

Additional work is needed for BFILE column usage. BUILD_STAGE_URL function is a recommended workaround

Severity

Low

Description

The transformation for BFILE datatype is VARCHAR. However, the translation for the Oracle built-in functions used to interact with BFILE types is currently not supported. The column is migrated to a VARCHAR in order to store the file path and name (check the BFILENAME_UDF documentation for more information).

The BUILD_STAGE_FILE_URL function is a recommended workaround to work with files in Snowflake. It will return a link to the specified file stored in a stage. Check the function documentation here.

Example Code

Input Code Oracle:

IN -> Oracle_01.sql
CREATE TABLE bfiletable ( bfile_column BFILE );

INSERT INTO bfiletable VALUES ( BFILENAME('mydirectory', 'myfile.png') );

Output Code:

OUT -> Oracle_01.sql
CREATE OR REPLACE TABLE bfiletable ( bfile_column
!!!RESOLVE EWI!!! /*** SSC-EWI-OR0105 - ADDITIONAL WORK IS NEEDED FOR BFILE COLUMN USAGE. BUILD_STAGE_FILE_URL FUNCTION IS A RECOMMENDED WORKAROUND ***/!!!
VARCHAR
)
COMMENT = '{"origin":"sf_sc","name":"snowconvert","version":{"major":1, "minor":0},"attributes":{"component":"oracle"}}'
;

INSERT INTO bfiletable
VALUES (PUBLIC.BFILENAME_UDF('mydirectory', 'myfile.png') );

Recommendations

  • Use the BUILD_STAGE_FILE_URL and the other file functions to handle files.

CREATE OR REPLACE TABLE bfiletable ( bfile_column
!!!RESOLVE EWI!!! /*** SSC-EWI-OR0105 - ADDITIONAL WORK IS NEEDED FOR BFILE COLUMN USAGE. BUILD_STAGE_FILE_URL FUNCTION IS A RECOMMENDED WORKAROUND ***/!!!
VARCHAR
)
COMMENT = '{"origin":"sf_sc","name":"snowconvert","version":{"major":1, "minor":0},{"attributes":{"component":"oracle"}}'
;

INSERT INTO bfiletable
VALUES (PUBLIC.BFILENAME_UDF('mydirectory', 'myfile.png') );

This function works with different cloud storage options, but for information regarding using local files with stages, check this documentation.

Last updated