I have written below script to retrieve BLOB data ( which has XML format) from oracle 11g, IF I run the Select statement in the query builder in some tool (i.e. ORACLE SQL Developer) it is giving me the BLOB values which is XML. Now I want to write a perl script which will invoke the BLOB as XML and print it on my screen.
#!/usr/bin/perl use strict; use warnings; use DBI; use DBD::Oracle; my $dbh = DBI->connect('dbi:Oracle:host=<IP ADRESS>;sid=11G;port=1521' +,'username', 'password', { RaiseError => 1, AutoCommit => 0 }) or die + "can not connect to the DB"; my $sth = $dbh->prepare(qq{select xmltype(SERVICE_SPECIFIC_DATA_V,871) + from CONNECTION_ACCOUNTS where account_id_n = 1462}); $sth->execute(); while ( my ($SERVICE_SPECIFIC_DATA_V) = $sth->fetchrow() ) { print STDOUT "BLOB is: $SERVICE_SPECIFIC_DATA_V\n"; } $sth->finish(); $dbh->disconnect;
Output of this program is :
BLOB is :ARRAY(0xdd705a0)
How Can I print the SERVICE_SPECIFIC_DATA_V xml values. or is there any alternative way where I can do it easily. Also, If I want to Insert or update this BLOB column which has XML, need Monks valuable suggestion on this. Thanks.

In reply to Handling BLOB data in ORACLE using perl script by bhushanQA

Title:
Use:  <p> text here (a paragraph) </p>
and:  <code> code here </code>
to format your post, it's "PerlMonks-approved HTML":



  • Posts are HTML formatted. Put <p> </p> tags around your paragraphs. Put <code> </code> tags around your code and data!
  • Titles consisting of a single word are discouraged, and in most cases are disallowed outright.
  • Read Where should I post X? if you're not absolutely sure you're posting in the right place.
  • Please read these before you post! —
  • Posts may use any of the Perl Monks Approved HTML tags:
    a, abbr, b, big, blockquote, br, caption, center, col, colgroup, dd, del, details, div, dl, dt, em, font, h1, h2, h3, h4, h5, h6, hr, i, ins, li, ol, p, pre, readmore, small, span, spoiler, strike, strong, sub, summary, sup, table, tbody, td, tfoot, th, thead, tr, tt, u, ul, wbr
  • You may need to use entities for some characters, as follows. (Exception: Within code tags, you can put the characters literally.)
            For:     Use:
    & &amp;
    < &lt;
    > &gt;
    [ &#91;
    ] &#93;
  • Link using PerlMonks shortcuts! What shortcuts can I use for linking?
  • See Writeup Formatting Tips and other pages linked from there for more info.