The WRITEAPPEND stored procedure appends a specified amount of data to the end of a specified internal LOB. The data to be written comes from the buffer parameter.
Applicability
This topic applies only to OceanBase Database Enterprise Edition. OceanBase Database Community Edition provides only the MySQL mode.
Syntax
DBMS_LOB.WRITEAPPEND (
lob_loc IN OUT NOCOPY BLOB,
amount IN INTEGER,
buffer IN RAW);
DBMS_LOB.WRITEAPPEND (
lob_loc IN OUT NOCOPY CLOB CHARACTER SET ANY_CS,
amount IN INTEGER,
buffer IN VARCHAR2 CHARACTER SET ANY_CS);
Parameters
| Parameter | Description |
|---|---|
| lob_loc | The locator of the internal LOB to write to. For more information, see Considerations. |
| amount | The amount of data to write. The value is in bytes for BLOBs, and in characters for CLOBs. |
| buffer | The buffer for the write operation. |
Note
If the amount specified is larger than the size of data in the buffer, an exception will be thrown. If the amount specified is smaller than the size of data in the buffer, only the data in the buffer will be appended to the LOB.
Exceptions
| Exception | Description |
|---|---|
| VALUE_ERROR | Any of the lob_loc, amount, and offset parameters is NULL, invalid, or out of range. |
| INVALID_ARGVAL | Several possibilities:
|
| QUERY_WRITE | Cannot perform a LOB write inside a query or PDML parallel execution server. |
| BUFFERING_ENABLED | The operation cannot be performed because LOB buffering is enabled. |
Considerations
The form of the
VARCHARbuffer must match the form of theCLOBparameter. If the type of the inputLOBparameter isCLOB, the data in the buffer must be of theCHARtype.When you call
DBMS_LOB.WRITEAPPENDfrom the client, such as in aBEGINorENDblock in OBClient, data in the buffer must use the client’s character set. Before the data is written from the buffer to theLOB, the database converts the character set of the client’s buffer to the character set of the server.You can choose not to wrap the
LOBoperation inside the Open/Close API. If you did not open theLOBbefore the operation, the functional and domain indexes on theLOBcolumn are updated during the call. However, if you opened theLOBbefore the operation, you must close it before you commit the transaction. When an internalLOBis closed, the functional and domain indexes on theLOBcolumn are updated.If you do not wrap the
LOBoperation in the Open/Close API, the functional and domain indexes are updated each time you write to theLOB. This may adversely affect performance. Therefore, we recommend that you wrap write operations on theLOBin theOPENorCLOSEstatement.When necessary,
WRITEAPPENDobtains theLOBbefore it appends data to it.