And close the locator dbms dbms
-- Save our new locator in the waterfalls table INSERT INTO waterfalls (falls_name, falls_web_page) VALUES ('Tannery Falls',web_page);
END;A BFILE locator is simply a combination of directory alias and filename. The actual file and directory don’t even need to exist. That is, the database allows you to create directory aliases for directories that do not yet exist, and BFILENAME allows you to create BFILE locators for files that do not yet exist. There are times when it’s convenient to do these things.
DECLARE
web_page BFILE;
html RAW(60);
amount BINARY_INTEGER := 60;
offset INTEGER := 1;
BEGIN
-- Retrieve the LOB locator for the web page SELECT falls_web_page
INTO web_page
FROM waterfalls
WHERE falls_name='Tannery Falls';-- Open the locator, read 60 bytes, and close the locator DBMS_LOB.OPEN(web_page);
DBMS_LOB.READ(web_page, amount, offset, html);
DBMS_LOB.CLOSE(web_page);
Working with LOBs | | | 433 |
---|
The output from this code will appear as follows:
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.0 Transitional//EN"
DBMS_LOB.LOADCLOBFROMFILE
Loads CLOBs from BFILEs. Takes care of any needed character set translation.DBMS_LOB.LOADBLOBFROMFILE
Loads BLOBs from BFILEs. Does the same thing as DBMS_LOB.LOADFROM‐FILE, but with an interface that is consistent with that of LOADCLOBFROMFILE.:= BFILENAME('BFILE_DATA','TanneryFalls.directions');
directions CLOB;
BEGIN
434 | | |
|
---|