Previous Table of Contents Next


This procedure is used to copy LOB data to another like-type LOB. The data occupying the destination LOB is overwritten from the point of the offset specified. If the dest_offset value is greater than the length of the LOB being copied to, the difference is padded with 0 byte spaces. This procedure is not valid for BFILE-type data.


PROCEDURE ERASE(

     lob_loc IN OUT BLOB, CLOB or NCLOB,

     amount IN OUT INTEGER,

     offset IN INTEGER DEFAULT 1);

lob_loc The locator of the LOB to erase from.
amount The number of characters or bytes to erase.
offset The character or byte after which to begin erasing.

This procedure erases data in a BLOB, CLOB, or NCLOB and leaves spaces in its stead.


FUNCTION GETLENGTH(

     lob_loc IN BLOB, CLOB, NCLOB)

RETURN INTEGER;



FUNCTION GETLENGTH(

     file_loc IN BFILE)

RETURN INTEGER;

This function returns the length of the LOB specified with lob_loc or file_loc (in bytes for BLOB or BFILE, and in characters for CLOB and NCLOB types):


FUNCTION INSTR(

     lob_loc IN BLOB,

     pattern IN RAW,

     offset IN INTEGER DEFAULT 1,

     nth IN INTEGER DEFAULT 1);



FUNCTION INSTR(

     lob_loc IN CLOB CHARACTER SET ANY_CS,

     pattern IN VARCHAR2 CHARACTER SETlob_loc%CHARSET,

     offset IN INTEGER DEFAULT 1,

     nth IN INTEGER DEFAULT 1)

RETURN INTEGER;



FUNCTION INSTR(

     file_loc IN BFILE,

     pattern IN RAW,

     offset IN INTEGER DEFAULT 1,

     nth IN INTEGER DEFAULT 1)

RETURN INTEGER; 

lob_loc or file_loc LOB locator.
pattern String of bytes or characters to search for.
offset Number of bytes or characters after which to search for the given pattern.
nth Indicates the number of pattern matches that must exist before the return value is TRUE.

The INSTR function looks for the nth occurrence of the given pattern in the specified LOB and returns the offset position of the occurrence, or a 0 if the specified occurrence is not found.


FUNCTION SUBSTR(

     lob_loc IN BLOB, CLOB, NCLOB or BFILE,

     amount IN INTEGER DEFAULT 32767,

     offset IN INTEGER DEFAULT 1)

RETURN RAW or VARCHAR2;

lob_loc Locator for LOB to read from.
amount Number of characters or bytes to read.
offset Offset in bytes or characters before reading should begin.

This function reads a portion of the specified LOB, beginning at the offset and ending after the number of bytes or characters specified is reached. It returns the portion of the LOB as a RAW in the case of a BLOB or BFILE, and VARCHAR2 in the case of a CLOB or NCLOB.


PROCEDURE READ(

     lob_loc IN BLOB, CLOB, NCLOB or BFILE,

     amount IN OUT BINARY_INTEGER,

     offset IN INTEGER,

     buffer OUT RAW);

lob_loc Locator of LOB to read from.
amount Number of characters or bytes to read.
offset Offset in bytes or characters to begin reading from.
buffer Variable to hold returned data.

Much like SUBSTR, this procedure retrieves a portion of a LOB. There are a few differences, though. One is that the number of characters or bytes actually read is returned in a binary integer.


PROCEDURE TRIM(

     lob_loc IN CLOB or BLOB,

     newlen IN INTEGER);

You can use this procedure to shorten a CLOB or BLOB to the specified newlen. If the length specified exceeds the length of the LOB to be trimmed, an ORA-22926 is returned. Unlike ERASE, removed data is not padded with spaces.


PROCEDURE WRITE(

     lob_loc IN BLOB, CLOB or NCLOB,

     amount IN BINARY_INTEGER,

     offset IN INTEGER,

     buffer IN RAW);

lob_loc Locator of LOB to write data into.
amount Number of characters or bytes to write from the buffer.
offset Offset in characters or bytes to begin writing buffer data.
buffer Data to be written.


Previous Table of Contents Next
Используются технологии uCoz