I think that your problem is in this piece of code:
IS
raw_data LONG RAW;
rawlen NUMBER;
hex_data VARCHAR2(32760); --<<---------- Variable to small ? Try: hex_data CLOB
char_data VARCHAR2(32760);
loop_counter NUMBER;
BEGIN
-- Get the blob using the rowid passed in.
-- Will always retrun only one row.
SELECT ole_object_blob
INTO raw_data
FROM tidblob
WHERE v_object_id = rowid;
-- Convert the raw data to hex.
hex_data := rawtohex(raw_data);
rawlen := length(hex_data); --<<------ DBMS_LOB.GET_LENGTH instead