17 Manipulating Large Objects
17 Manipulating Large Objects
17 Manipulating Large Objects
Programming
20 Objects
What Is a LOB?
LOBs are used to store large, unstructured data such as text, graphic
images, films, and sound waveforms.
Text (CLOB)
What Is a LOB?
CLOB BLOB
What Are BFILEs?
• BFILEs are external large objects (LOBs) stored in OS files that are external
to database tables.
• The BFILE data type stores a locator to the physical file.
• BFILEs are read-only; they do not participate in transactions
Movie (BFILE)
Using the DBMS_LOB Package
– Working with LOBs often requires the use of the Oracle-supplied
DBMS_LOB package.
– LOB data can be retrieved directly using SQL.
– DBMS_LOB provides routines to access and manipulate internal and
external LOBs.
• Modify LOB values:
APPEND, COPY, ERASE, TRIM, WRITE, LOADFROMFILE
• Read or examine LOB values:
GETLENGTH, INSTR, READ, SUBSTR
• Specific to BFILEs:
FILECLOSE, FILECLOSEALL, FILEEXISTS, FILEGETNAME,
FILEISOPEN, FILEOPEN
Managing BFILEs
mkdir /home/oracle/labs/DATA_FILES/MEDIA_FILES
UPDATE employees
SET video = BFILENAME('DATA_FILES', 'Winters.avi')
WHERE employee_id = 120;
Populating a BFILE Column with PL/SQL
EXECUTE LOAD_FILE('test.png');