Turn from: http://www.cnblogs.com/hellofei/archive/2010/03/25/1695363.html
InStr function and substr function
The InStr function is used to find the nth pattern-matching string from a large object, starting at the specified position.
The InStr function syntax for finding strings in internal large objects is as follows:
DBMS_LOB.INSTR (
Lob_loc in Blob,
Pattern in Raw,
Offset in integer: = 1;
Nth in integer: = 1)
return integer;
DBMS_LOB.INSTR (
Lob_loc in Clob character set Any_cs,
Pattern in varchar2 character set Lob_loc%charset,
Offset in Integer:=1,
Nth in integer: = 1)
return integer;
Lob_loc is a locator for an internal large object
Pattern is the mode to match
Offset is the starting position to search for a matching file
Nth is the nth match to be made
substr function
The SUBSTR function is used to extract the specified number of bytes from a large object. This function is usually used when we need only a portion of a large object.
The SUBSTR function syntax for manipulating large objects inside is as follows:
DBMS_LOB.SUBSTR (
Lob_loc in Blob,
Amount in integer: = 32767,
Offset in integer: = 1)
return raw;
Dbms_lob.substr (
Lob_loc in Clob character set any_cs,
amount in integer: = 32767,
Offset in (integer: = 1)
return varchar2 character set lob_loc%charset;
The meanings of each of these parameters are as follows:
Lob_loc is the large object locator that the SUBSTR function is to manipulate
amount is the number of bytes to extract from a large object
offset refers to where the data is extracted from a large object.
If the data is extracted from a large object successfully, the function returns a raw value. If there is a situation, return null:
1 Any input parameter tail null
&NBSP;2 Amount < 1
3 amount > 32767
4 offset < 1< Br> 5 Offset > Lobmaxsize