http://qs321.pair.com?node_id=1142803

bhushanQA has asked for the wisdom of the Perl Monks concerning the following question:

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.