TRY_TO_FILE

A version of TO_FILE that returns NULL instead of raising an error.

Syntax

Use one of the following:

TRY_TO_FILE( <stage_name>, <relative_path> )

TRY_TO_FILE( <file_url> )

TRY_TO_FILE( <metadata> )

Arguments

stage_name

The name of the stage where the file is located, as a string, in the form '@stage_name'.

relative_path

The path to the file on the stage specified by stage_name as a string.

file_url

A valid stage or scoped file URL as a string.

metadata

An OBJECT containing all the required FILE metadata. A FILE must have CONTENT_TYPE, SIZE, ETAG, and LAST_MODIFIED fields, plus the file’s location (that is, STAGE plus RELATIVE_PATH, STAGE_FILE_URL, or SCOPED_FILE_URL).

Returns

A FILE, or NULL.

Usage notes

Returns NULL when:

  • The supplied URL is not validL.

  • The file is on a stage that the user has no permissions to access.

  • The supplied metadata doesn’t contain the required FILE fields.

Examples

See TO_FILE.

Language: English