Read blob type data, DBMS_LOB.READ : blob « Data Type « Oracle PL / SQL

Home
Oracle PL / SQL
1.Aggregate Functions
2.Analytical Functions
3.Char Functions
4.Constraints
5.Conversion Functions
6.Cursor
7.Data Type
8.Date Timezone
9.Hierarchical Query
10.Index
11.Insert Delete Update
12.Large Objects
13.Numeric Math Functions
14.Object Oriented Database
15.PL SQL
16.Regular Expressions
17.Report Column Page
18.Result Set
19.Select Query
20.Sequence
21.SQL Plus
22.Stored Procedure Function
23.Subquery
24.System Packages
25.System Tables Views
26.Table
27.Table Joins
28.Trigger
29.User Previliege
30.View
31.XML
Oracle PL / SQL » Data Type » blob 
Read blob type data, DBMS_LOB.READ
 

SQL> CREATE TABLE myTable (
  2    id          INTEGER PRIMARY KEY,
  3    blob_column BLOB NOT NULL
  4  );

Table created.

SQL>
SQL>
SQL> CREATE OR REPLACE PROCEDURE initialize_blob(blob_par IN OUT BLOB,
  2    id_par IN INTEGER
  3  IS
  4  BEGIN
  5    SELECT blob_column
  6    INTO blob_par
  7    FROM myTable
  8    WHERE id = id_par;
  9  END initialize_blob;
 10  /

Procedure created.

SQL>
SQL>
SQL>
SQL>
SQL> CREATE OR REPLACE PROCEDURE read_blob_example(id_par IN INTEGERIS
  2    blobValue BLOB;
  3    binary_buffer_var RAW(25);
  4    offset INTEGER := 1;
  5    amount_var INTEGER := 25;
  6  BEGIN
  7    initialize_blob(blobValue, id_par);
  8    DBMS_LOB.READ(blobValue, amount_var, offset, binary_buffer_var);
  9    DBMS_OUTPUT.PUT_LINE('binary_buffer_var = ' || binary_buffer_var);
 10    DBMS_OUTPUT.PUT_LINE('amount_var = ' || amount_var);
 11  END read_blob_example;
 12  /

Procedure created.

SQL>
SQL>
SQL> drop table myTable;

Table dropped.

SQL>

   
  
Related examples in the same category
1.Read data in for sql statement
2.Blob type column
3.Initialize blob type data
4.A PL/SQL block to read an operating system file called BLOB.JPG that contains 1 row of binary data.
java2s.com  | Contact Us | Privacy Policy
Copyright 2009 - 12 Demo Source and Support. All rights reserved.
All other trademarks are property of their respective owners.