Sure. Try the following instead:
import cx_Oracle
connection =3D cx_Oracle.Connection("anthony/dev@dev")
cursor =3D connection.cursor()
cursor.execute("""
select
Id,
XMLType.GetClobVal(Value)
from XMLTable""")
for id, value in cursor:
print "Id:", id
print "Value (length):", value.size()
file("test_%d.xml" % id, "w").write(value.read())
Note the use of XMLType.GetClobVal() since cx_Oracle still does not
know how to handle Oracle named objects -- its on my todo list but too
many other things keep coming up.... :-)
Hope that helps.
On 4/15/05, Carl Bignell <cbi...@nr...> wrote:
> All,
>=20
> I have been trying to retrieve xml data type from
> an oracle database. The server uses Oracle 10g and
> I am using python 2.4.1, cx_Oracle 4.1, Oracle client for 10g
> all on a windows XP machine (with sp 2).
>=20
> The database has two fields a string and an xmltype. If I
> retrieve with the SQL statment
>=20
> select str from proposal
>=20
> where specifying the string field only all works fine.
>=20
> If I use
>=20
> (a) select * from proposals
>=20
> I recieve the error
>=20
> NotSupportedError: Variable_TypeByOracleDataType: unhandled data type 108
>=20
> (b) setinputsize(value=3Dcx_Oracle.CLOB) with the same select statment
> I recieve the error:
>=20
> cursor.execute( "select * from proposals" )
> DatabaseError: ORA-01036: illegal variable name/number
>=20
> Any suggestions? Many thanks in advance.
>=20
> Carl Bignell
> cbi...@nr...
>=20
> -------------------------------------------------------
> SF email is sponsored by - The IT Product Guide
> Read honest & candid reviews on hundreds of IT Products from real users.
> Discover which products truly live up to the hype. Start reading now.
> http://ads.osdn.com/?ad_id=3D6595&alloc_id=3D14396&op=3Dclick
> _______________________________________________
> cx-oracle-users mailing list
> cx-...@li...
> https://lists.sourceforge.net/lists/listinfo/cx-oracle-users
>
|