How to read and insert BLOB via a sql script?

+1 vote
asked May 25, 2018 by Hitesh Garg (352 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?

1 Answer

+1 vote
answered May 25, 2018 by Rahul Singh (543 points)  
selected May 25, 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;

124 questions

41 answers


926 users

Most popular tags

java python python3 oracle database java-8 sql-server python2 oracle11g git oracle-12g command-line maven sql-server-2012 sql input array list fenitoina dilantin javaçš„ angular javascripts git-branch intellij-idea hashmap collection file-io io temovate clobetasol ampicillin principen daclatasvir daklinza vasotec enalapril nexium esomeprazole tadalafil tadlis sildenafil citrate pefomax xeloda capecitabina clobetasol temovate stemetil prochlorperazine methotrexate methotrexate sildenafilo y dapoxetina super kamagra norvasc amlodipine citalopram celexa amitriptylin saroten vitamin b12 methylcobalamin valaciclovir valtrex zudena udenafil sildenafil citrate vigour depakote divalproex retin-a tretinoine sildenafil citrate ip-max nizoral ketoconazol ciaton tadalafil norethisteronacetat aygestin indomethacin indocin tiova tiotropium bromid finasterida proscar lithium carbonate eskalith finasterida propecia levitra vardenafil vantin cefpodoxima loxitane loxapine rulide roxithromycine avodart dutasterid tecnomax sildenafil citrate methylcobalamin vitamin b12 permethrin acticin etinilestradiol norgestrel ovral pk-merz amantadin cycrin medroxyprogesterone serophene clomiphene spironolactone aldactone mesalazin pentasa zebeta bisoprolol cytodrox hydroxyurea ampicillin ampicillin pletal cilostazol paracetamol panadol pepcid famotidina meclizine hydrochloride antivert donaton tadalafil sdf dsfs sdgfgsdg mac null-pointer-exception constructor oracle-12c terminal hibernate-5 hibernate git-merge es6 programming git-amend git-commit java-stream git-remote multithreading access-modifiers nested-classes
Welcome to Codingeek Q&A, where you can ask questions and receive answers from other members of the community.