READ v18
The READ procedure reads a portion of a large object into a buffer starting at the specified offset.
READ(<lob_loc> { BLOB | CLOB }, <amount> IN OUT NUMBER, <offset> NUMBER, <buffer> OUT { RAW | VARCHAR2 }) READ(<file_loc> { BFILE }, <amount> IN OUT NUMBER, <offset> IN NUMBER, <buffer> OUT { RAW })
Parameters
lob_loc
Large object locator of the large object to read.
file_loc
File locator of the BFILE to read.
amount
Number of bytes/characters read. If there's no more data to read, then amount returns 0 and a DATA_NOT_FOUND exception is thrown.
offset
Position to begin reading. The first byte/character is position 1.
buffer
Variable to receive the large object. If lob_loc is a BLOB, then buffer must be RAW. If lob_loc is a CLOB, then buffer must be VARCHAR2. If file_loc is BFILE, then buffer must be RAW.
Example
DECLARE src_loc bfile := BFILENAME('ANOTHER_DIR', 'a.txt'); Buffer RAW(1024); Amount NUMBER := 1024; Position NUMBER := 1; BEGIN /* Opening the source BFILE is mandatory */ DBMS_LOB.OPEN (src_loc, DBMS_LOB.LOB_READONLY); DBMS_LOB.READ (src_loc, Amount, Position, Buffer); /* Close the BFILE: */ DBMS_LOB.FILECLOSE(src_loc); COMMIT; END;
- On this page
- Parameters
- Example