602SQL Documentation Index  

wb_lob_read

PHP

string wb_lob_read(resource lob, integer offset, 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.
offset
Start position of the part to read (in characters).
size
Size of the part to read (in characters).


Description

Reads and returns a part of the lob LOB, starting with the character on the offset position (the first character has offset=0) and of the size character size (or to the end of the LOB if the length is less than offset+size).

Characters are:



Returns



Example

Read the CLOB contents and send to the output document:

$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);
$start=0;
while( ($segment=wb_lob_read($rec["CLOB_COLUMN"],$start,1024))!==FALSE ) {
  echo $segment;
  $start+=1024;
...
  }
wb_close($rec["CLOB_COLUMN"]);

Viz