602SQL Documentation Index  

wb_lob_truncate

PHP

boolean wb_lob_truncate(resource lob, integer size)


Parameters

lob
An open LOB, the result of the wb_result function in the WB_LOBMODE_RESOURCE mode, or one of the array items returned by the wb_fetch_into function. The cursor that the LOB was retrieved from must be editable.
size
new length of the LOB in characters


Description

Truncates the length of the lob LOB to the size characters.

Characters are:

The size parameter value must be in the interval 0 to N, where N is the current LOB size (can be obtained by the wb_lob_length function). LOB data that is not inside the interval will be deleted.

You cannot extend a LOB with this function. You may only append data to a LOB by calling the wb_lob_write function.



Returns

TRUE if successful, otherwise FALSE.



Example

Delete a CLOB:

$cursor=wb_exec($connection,"SELECT clob_column FROM clob_table WHERE id=1");
wb_set_lob_mode($cursor,WB_LOBMODE_RESOURCE);
wb_fetch_into($cursor,$rec);
echo "Length of the CLOB is ".wb_lob_length($rec["CLOB_COLUMN"])."\n";
wb_lob_truncate($rec["CLOB_COLUMN"],0);
echo "Length of the CLOB after deleting its contents ".wb_lob_length($rec["CLOB_COLUMN"])."\n";

Viz