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.
-
Are you posting in the right place? Check out Where do I post X? to know for sure.
-
Posts may use any of the Perl Monks Approved HTML tags. Currently these include the following:
<code> <a> <b> <big>
<blockquote> <br /> <dd>
<dl> <dt> <em> <font>
<h1> <h2> <h3> <h4>
<h5> <h6> <hr /> <i>
<li> <nbsp> <ol> <p>
<small> <strike> <strong>
<sub> <sup> <table>
<td> <th> <tr> <tt>
<u> <ul>
-
Snippets of code should be wrapped in
<code> tags not
<pre> tags. In fact, <pre>
tags should generally be avoided. If they must
be used, extreme care should be
taken to ensure that their contents do not
have long lines (<70 chars), in order to prevent
horizontal scrolling (and possible janitor
intervention).
-
Want more info? How to link
or How to display code and escape characters
are good places to start.
|