BFILE
A BFILE
stores a pointer to a file.
Creating a Directory Object
The directory object stores the directory where the files are located.
CREATE DIRECTORY SAMPLE_FILES_DIR AS 'C:\sample_files';
SQL> CREATE TABLE my_bfile(
2 id INTEGER PRIMARY KEY,
3 bfile_column BFILE NOT NULL
4 );
Table created.
SQL>
Populating a BFILE
Column
INSERT INTO my_bfile (id, bfile_column)
VALUES (1, BFILENAME('SAMPLE_FILES_DIR', 'text.txt'));
INSERT INTO my_bfile (id, bfile_column)
VALUES (2, BFILENAME('SAMPLE_FILES_DIR', 'binary.doc'));
SELECT id FROM my_bfile;