Friday, May 14, 2021

Large Object(LOB) in Oracle

  • A LOB is a data type that is used to store large, unstructured data such as Text(CLOB), Graphic Images(BLOB), Video Clippings(BFILE),..etc. Structured data, such as a customer record, may be a few hundred bytes large, but even small amounts of multimedia data can be thousands of times larger. 
  • Also, multimedia data may reside in operating system (OS) files, which may need to be accessed from a database.
  • There are four large object data types:
    • BLOB: BLOB represents a binary large object, such as a video clip.
    • CLOB: CLOB represents a character large object.
    • NCLOB: NCLOB represents a multiple-byte character large object.
    • BFILE: BFILE represents a binary file stored in an OS binary file outside the database. The BFILE column or attribute stores a file locator that points to the external file.
  • LOBs are characterized in two ways, according to their interpretations by the Oracle server i.e. binary or character and their storage aspects. 
  • LOBs can be stored internally i.e. inside the database or in host files. 
  • There are two categories of LOBs:
    • Internal LOBs (CLOB, NCLOB, BLOB): Stored in the database
    • External files (BFILE): Stored outside the database
  • Oracle Database 10g performs implicit conversion between CLOB and VARCHAR2 data types.

  • The other implicit conversions between LOBs are not possible. For Ex:, if the user creates a table XYZ with a CLOB column and a table ABC with a BLOB column, the data is not directly transferable between these two columns.
  • BFILEs can be accessed only in read-only mode from an Oracle server.
  • There are two parts to a LOB:
    • LOB value: The data that constitutes the real object being stored
    • LOB locator: A pointer to the location of the LOB value that is stored in the database
  • Irrespective of where the LOB value is stored, a locator is stored in the row. We can think of a LOB locator as a pointer to the actual location of the LOB value.
  • A LOB column does not contain the data; it contains the locator of the LOB value.
  • When a user creates an internal LOB, the value is stored in the LOB segment and a locator to the
  • out-of-line LOB value is placed in the LOB column of the corresponding row in the table.
  • External LOBs store the data outside the database, so only a locator to the LOB value is stored in the table.
  • To access and manipulate LOBs without SQL data manipulation language (DML), we have to create a LOB locator. The programmatic interfaces operate on the LOB values by using these locators in a manner similar to OS file handles.

2 comments:

  1. Optumflex Solutions for your ERP business needs. Visit Optumflex.com for more information.

    ReplyDelete

Query To Fetch AP Invoice Details From SO Number(Doc ID 2949013.1)

SELECT dh.source_order_number       ,df.source_line_number as so_line_number   ,df.fulfill_line_number    ,ddr.doc_user_key as po_number...