The TRIM stored procedure trims an internal LOB to the length that you specified for the newlen parameter.
The length in the TRIM stored procedure is specified in bytes for BLOBs, and in characters for CLOBs.
Note
The TRIM stored procedure decreases the length of a LOB down to the value specified for the newlen parameter.
If you attempt to TRIM an empty LOB, nothing happens and TRIM does not throw any exception. If the new length you specify in newlen is greater than the size of the LOB, an exception will be thrown.
Applicability
This topic applies only to OceanBase Database Enterprise Edition. OceanBase Database Community Edition provides only the MySQL mode.
Syntax
DBMS_LOB.TRIM (
lob_loc IN OUT NOCOPY BLOB,
newlen IN INTEGER);
DBMS_LOB.TRIM (
lob_loc IN OUT NOCOPY CLOB CHARACTER SET ANY_CS,
newlen IN INTEGER);
Parameters
| Parameter | Description |
|---|---|
| lob_loc | The locator of the internal LOB whose length you want to trim. For more information, see Considerations. |
| newlen | The new trimmed length of LOB, in bytes for BLOBs and in characters for CLOBs. |
Exceptions
| Exception | Description |
|---|---|
| VALUE_ERROR | The value of lob_loc is NULL. |
| 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
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. To avoid adversely affecting performance, we recommend that you wrap write operations on theLOBin theOPENorCLOSEstatement.When necessary,
TRIMobtains theLOBbefore it changes the length of theLOB, unless the specified new length is 0.