Skip to content

TO_LOB

TO_LOB(source)Where “source” is a LONG value to be converted to a LOB value.

Section titled “TO_LOB(source)Where “source” is a LONG value to be converted to a LOB value.”
  • source: This parameter is the LONG value that will be converted into a LOB value. It represents the original data that is to be transformed. Any additional LONG database columns or LONG PL/SQL variables can act as the source. It accepts any LONG value and converts it into a LOB datatype.
CREATE TABLE images(
img_id NUMBER,
img BFILE
);
INSERT INTO images VALUES(1, BFILENAME('IMAGES_DIR', 'img1.jpg'));
UPDATE images SET img = TO_LOB(img) WHERE img_id = 1;

The SELECT img FROM images WHERE img_id = 1; query returns:

CLOB

The TO_LOB function is used to convert a BFILE or BLOB datatype to a CLOB or NCLOB. In the example, an image stored as a BFILE is converted into CLOB format using the TO_LOB function.