Home » Open Source » Programming Interfaces » How to SELECT XMLTYPE data with Perl DBD::Oracle? ((Oracle: 10.2-11.2, Perl: 5.20.2, DBI: 1.633, DBD::Oracle: 1.74))
How to SELECT XMLTYPE data with Perl DBD::Oracle? [message #641583] Tue, 18 August 2015 08:27 Go to previous message
Michel Cadot
Messages: 68643
Registered: March 2007
Location: Nanterre, France, http://...
Senior Member
Account Moderator

You can simply select an XMLTYPE column in SQL*Plus like:
SQL> select  WAREHOUSE_SPEC
  2  from OE.WAREHOUSES
  3  where WAREHOUSE_SPEC is not null and rownum = 1
  4  /
WAREHOUSE_SPEC
--------------------------------------------------------
<?xml version="1.0"?>
<Warehouse>
  <Building>Owned</Building>
  <Area>25000</Area>
  <Docks>2</Docks>
  <DockType>Rear load</DockType>
  <WaterAccess>Y</WaterAccess>
  <RailAccess>N</RailAccess>
  <Parking>Street</Parking>
  <VClearance>10 ft</VClearance>
</Warehouse>

This is a shorcut for the more correct:
select W.WAREHOUSE_SPEC.getclobval() WAREHOUSE_SPEC
from OE.WAREHOUSES W
where WAREHOUSE_SPEC is not null and rownum = 1
/

Now without changing the first query into the second one, is it possible to get the XML string with Perl DBD::Oracle?

I find one page on the web saying "don't waste your time to search on the web, it is not possible" and another one saying "I succeeded to do it binding a variable with attribute SQLT_STR type" but he did not show the code.
I tried with many different types and failed.

I attach a sample of code if you want to try by yourself.

[Cross-ref: http://www.dba-village.com/village/dvp_forum.OpenThread?ThreadIdA=78184]

  • Attachment: t7.pl
    (Size: 1.84KB, Downloaded 3205 times)

[Updated on: Tue, 18 August 2015 08:41]

Report message to a moderator

 
Read Message
Read Message
Read Message
Read Message
Read Message
Previous Topic: How to get SELECT columns size with Perl DBI+DBD::Oracle?
Next Topic: Downloaded 114 BLOBS using PHP before getting ORA-12537: TNS Connection Closed
Goto Forum:
  


Current Time: Tue Apr 23 01:26:18 CDT 2024