BFILENAME

BFILENAME is a function in Oracle SQL that returns a BFILE locator that is associated with a physical LOB binary file on the server file system. This locator points to an external file in a directory that is already specified within the Oracle Database. BFILENAME is often used to initialize a BFILE column or attribute to a specific file.

BFILENAME(directory_alias, file_name)where,- directory_alias is a character value that specifies the alias for the application directory,- file_name is a character value that specifies the name of the file.

  • directory_alias: This is a character value that represents the alias of the directory within the application. It assists in the identification and organization of data.
  • file_name: This is a character value which designates the specific name of the file. It allows for individual file recognition and access within the overall data management system.

Example

DECLARE
v_file BFILE;
BEGIN
v_file := BFILENAME('MY_DIRECTORY', 'my_file.txt');
DBMS_OUTPUT.PUT_LINE(v_file);
END;

Output

BFILE('MY_DIRECTORY','my_file.txt')

Explanation

In the example, BFILENAME function is used to create a BFILE locator that references a file located in the directory named MY_DIRECTORY with the name my_file.txt. The BFILE locator is stored in the v_file variable. The DBMS_OUTPUT.PUT_LINE procedure is used to display the BFILE locator.

For in-depth explanations and examples SQL keywords where you write your SQL, install our extension.