7.2 Benefits of Using the Data Interface for LOBs

This section discusses the benefits of the using the Data Interface for LOBs.

Following are the benefits of using the Data Interface for LOBs:

  • If your application uses LONG data types, then you can use the same application with LOB data types with little or no modification of your existing application required. To do so, just convert LONG columns in your tables to LOB columns.
  • The Data Interface gives you the best performance if you know the maximum size of your LOB data, and you intend to read or write the entire LOB. A piecewise INSERT or fetch using the data interface makes only 1 round-trip the server, as opposed to using LOB API which makes separate round-trips to get the locator and to read/write data.

  • You can read LOB data in one OCIStmtFetch() call, instead of fetching the LOB locator first and then calling OCILobRead2(). This improves performance when you want to read LOB data starting at the beginning.

  • You can use array bind and define interfaces to insert and select multiple rows with LOBs in one round trip. Irrespective of whether the LOB data is inserted or fetched using single piece, piecewise or callbacks, it is inserted or fetched in a single round trip for multiple rows when using array binds or defines.


If your application needs to perform random or piecewise read or write calls to LOBs, which means it needs to specify the offset or amount of the operation, then use the LOB APIs instead of the Data Interface.

Most of the examples in the following sections use the print_media table. Following is the structure of the print_media table.

Figure 7-1 print_media Table

print_media table