UTL_FILE.FOPEN_UDF (VARCHAR,VARCHAR)

Important Notice: Migration of Documentation Website

Please be advised that our documentation website is currently undergoing a migration to a new platform. To ensure you have access to the most up-to-date information, we kindly request that you visit our new documentation website located at:

Official Snowflake Snowconvert Documentation

For any immediate assistance or if you encounter any issues, please contact our support team at [email protected].

Thank you for your understanding.

Definition

This user-defined function (UDF) is used to replicate the functionality of the Oracle UTL_FILE_FOPEN procedure.

UTL_FILE.FOPEN_UDF(FILENAME VARCHAR,OPEN_MODE VARCHAR)

Parameters

FILENAME VARCHAR

The file to be opened.

OPEN_MODE VARCHAR

Indicates de mode on which the file will be available.

Returns

Returns a varchar with the result.

Usage example

Input:

CREATE OR REPLACE PROCEDURE PROC()
RETURNS VARCHAR
LANGUAGE SQL
EXECUTE AS CALLER
AS
$$
   DECLARE
    file_data  VARIANT;
   BEGIN
   
    CALL UTL_FILE.FOPEN_UDF('test2.csv','a');
    
    SELECT
      *
    INTO
      file_data
    FROM
      TABLE(RESULT_SCAN(LAST_QUERY_ID()));
 
      
   END
$$;

CALL PROC();

Output:

null

Last updated