Oracle9i Supplied PL/SQL Packages and Types Reference Release 1 (9.0.1) Part Number A89852-02 |
|
DBMS_LOB , 25 of 26
This procedure writes a specified amount of data into an internal LOB
, starting from an absolute offset from the beginning of the LOB
. The data is written from the buffer
parameter.
WRITE
replaces (overwrites) any data that already exists in the LOB
at the offset, for the length you specify.
There is an error if the input amount is more than the data in the buffer. If the input amount is less than the data in the buffer, then only amount bytes or characters from the buffer is written to the LOB
. If the offset you specify is beyond the end of the data currently in the LOB
, then zero-byte fillers or spaces are inserted in the BLOB
or CLOB
respectively.
DBMS_LOB.WRITE ( lob_loc IN OUT NOCOPY BLOB, amount IN BINARY_INTEGER, offset IN INTEGER, buffer IN RAW); DBMS_LOB.WRITE ( lob_loc IN OUT NOCOPY CLOB CHARACTER SET ANY_CS, amount IN BINARY_INTEGER, offset IN INTEGER, buffer IN VARCHAR2 CHARACTER SET lob_loc%CHARSET);
Exception | Description |
---|---|
VALUE_ERROR |
Any of |
INVALID_ARGVAL |
- |
The form of the VARCHAR2
buffer must match the form of the CLOB
parameter. In other words, if the input LOB
parameter is of type NCLOB
, then the buffer must contain NCHAR
data. Conversely, if the input LOB
parameter is of type CLOB
, then the buffer must contain CHAR
data.
When calling DBMS_LOB
.WRITE
from the client (for example, in a BEGIN
/END
block from within SQL*Plus), the buffer must contain data in the client's character set. Oracle converts the client-side buffer to the server's character set before it writes the buffer data to the LOB
.
It is not mandatory that you wrap the LOB operation inside the Open/Close APIs. If you did not open the LOB before performing the operation, the functional and domain indexes on the LOB column are updated during the call. However, if you opened the LOB before performing the operation, you must close it before you commit or rollback the transaction. When an internal LOB is closed, it updates the functional and domain indexes on the LOB column.
If you do not wrap the LOB operation inside the Open/Close API, the functional and domain indexes are updated each time you write to the LOB. This can adversely affect performance. Therefore, it is recommended that you enclose write operations to the LOB within the OPEN
or CLOSE
statement.
CREATE OR REPLACE PROCEDURE Example_16 IS lob_loc BLOB; buffer RAW; amt BINARY_INTEGER := 32767; pos INTEGER := 2147483647; i INTEGER; BEGIN SELECT b_col INTO lob_loc FROM lob_table WHERE key_value = 12 FOR UPDATE; FOR i IN 1..3 LOOP dbms_lob.write (lob_loc, amt, pos, buffer); -- fill in more data pos := pos + amt; END LOOP; EXCEPTION WHEN some_exception THEN handle_exception; END;
|
Copyright © 1996-2001, Oracle Corporation. All Rights Reserved. |
|