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 INTEGER) IS
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>