The TRIM stored procedure trims the value of an internal LOB to the length specified by the newlen parameter.
The TRIM stored procedure specifies the length in bytes for a BLOB and the length in characters for a CLOB.
Note
The TRIM stored procedure reduces the length of a LOB to the value specified by the newlen parameter.
If you attempt to trim an empty LOB, no result is returned, and the TRIM procedure does not return an error. If the new length specified by the newlen parameter exceeds the size of the LOB, an exception is raised.
Applicability
This topic applies only to OceanBase Database Enterprise Edition. OceanBase Database Community Edition does not support this feature.
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 is to be adjusted. For more information, see DBMS_LOB usage notes. |
| newlen | The new length of the trimmed LOB (in bytes for a BLOB and in characters for a CLOB). |
Exceptions
| Exception | Description |
|---|---|
| VALUE_ERROR | The value of lob_loc is NULL. |
| INVALID_ARGVAL | The value of new_len is less than 0 or greater than LOBMAXSIZE. |
| QUERY_WRITE | The LOB write operation cannot be performed in a query or in a parallel DML server. |
| BUFFERING_ENABLED | If buffering is enabled for the LOB, the operation cannot be performed while buffering is enabled for the LOB. |
Considerations
You do not have to wrap
LOBoperations in the Open/Close interface. If you do not open theLOBbefore executing the operation, the functional index and domain index on theLOBcolumn are updated during the call. If you open theLOBbefore executing the operation, you must close it before committing the transaction. When you close an internalLOB, the functional index and domain index on theLOBcolumn are updated.If you do not wrap
LOBoperations in the Open/Close API, the functional index and domain index on theLOBcolumn are updated each time you write to theLOB. To avoid performance issues, we recommend that you includeLOBwrite operations inOPENorCLOSEstatements.If the new length is not 0,
TRIMobtains theLOBbefore changing its length.
