The use of the InStr and SUBSTR functions of Dbms_lob the ___ function

Source: Internet
Author: User

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

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.