How to read and insert BLOB via a sql script?

+1 vote
918 views
asked May 24, 2018 by Hitesh Garg (355 points)  

I have to update a blob value in my project, usually it is done via a UI but UI is not working for now and I want to update the value so as to make the rest of the system up and running.
I am currently using Oracle 12 and sqldeveloper and I am unable to update the value

Is there any set of queries to do that?

commented Sep 5 by sara (10 points)  
The basic concept of a research proposal is it shows why your project is worth. So it necessary to describe what will you investigate and why with a logical flow. Academics often have to write a research proposal to get funding for their project. But as a student, you must write a research proposal to get your dissertation to approve. So for both the purpose, it is mandatory to write a quality dissertation. Our consultation provides you with a unique style of writing that attracts the readers and help you have a quality research proposal.  (Tutors India)

1 Answer

+1 vote
answered May 24, 2018 by Rahul Singh (553 points)  
selected May 24, 2018 by Hitesh Garg
 
Best answer

This can be achieved by the inbuild methods -

  • For String to BLOB - RAWTOHEX

    create table blobex(id integer, item blob);
    insert into blob
    ex values(2, RAWTOHEX('Test'));

  • For BLOB to String - utlraw.castto_varchar2(dbms_lob.substr(COLUMN_NAME))

    select utlraw.casttovarchar2( dbmslob.substr( item ,4000,1)) from blob_ex where id=2;

Welcome to Codingeek Q&A, where you can ask questions and receive answers from other members of the community.
...