Re: [cx-oracle-users] using bind variables to insert into xmltype colums
Brought to you by:
atuining
From: Anthony T. <ant...@gm...> - 2005-04-08 16:10:53
|
The following code works for me: connection = cx_Oracle.Connection("user/pw@tns") cursor = connection.cursor() cursor.setinputsizes(value = cx_Oracle.CLOB) cursor.execute("insert into xmltable values (:value)", value = "A very long XML string") where in my case the xml was about 50 KB. Hope this helps! If not, can you post the exact code you are using so I can see if anything obvious shows up. Thanks. On Apr 7, 2005 5:33 PM, Charl P. Botha <cp...@gm...> wrote: > Dear list, > > I'm trying to insert xml into xmltype columns. My xml is longer than > 4000 characters, so I get "ORA-01704: string literal too long" if I > try and insert my xml as a string literal: > cursor.execute("insert into table xmltable values(xmltype('<xml>very > long string...</xml>'))") > > As far as I could see, it seems one is supposed to use bind variables > in cases such as these. So I tried something similar to the > following: > > xml_clob = cx_Oracle.CLOB > cursor.execute("insert into table xmltable values(xmltype(:xml_clob))", > xml_clob = '<xml>very long string...</xml>') > > This yields a: "ORA-01461: can bind a LONG value only for insert into > a LONG column". > > How else can I insert long XML strings into xmltype columns from > cx_Oracle? A temporary column of sorts? Any tips on this would be > greatly appreciated! > > Thanks, > Charl > > -- > charl p. botha http://cpbotha.net/ http://visualisation.tudelft.nl/ > > ------------------------------------------------------- > 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=6595&alloc_id=14396&op=click > _______________________________________________ > cx-oracle-users mailing list > cx-...@li... > https://lists.sourceforge.net/lists/listinfo/cx-oracle-users > |