Re: [cx-oracle-users] How to insert LOB/CLOB/BLOB ??
Brought to you by:
atuining
From: Anthony T. <an...@co...> - 2003-09-03 15:58:37
|
The code you give works fine on our machines which have the same configuration except for Oracle, which is Oracle 8.1.7 and Oracle 9.2.0. There are a fair number of bugs in Oracle 8.1.5 and I would recommend upgrading Oracle to at least 8.1.7, if not 9.2.0 (depending on your needs and the risks you see with either upgrade). Oracle is terminating support for Oracle 8i at the end of the year and Oracle 10g is coming out at the end of this week. If upgrading is not an option for some reason, you will have to write your code differently to work around the bugs in Oracle 8.1.5. You can try this style of code as well: import cx_Oracle connection = cx_Oracle.connect("user/pw@dsn") cursor = connection.cursor() cursor.execute("insert into testclob values (:pint, empty_clob())", pint = 1) cursor.execute("select clobval from testclob where id = :pint", pint = 1) clob, = cursor.fetchone() clob.write(longString) This method is more code and more network traffic intensive but otherwise works identically. Hope this helps. On Wed, 2003-09-03 at 06:39, vi...@cs... wrote: > Hi all, > I am new to this list and also to the cx_Oracle package. Previously I was > working with other database systems with Python. I recently switched to > Oracle and cx_Oracle. > Now I am learning to use this package using the tests provided with package. > But I am facing problems in inserting large object data in tables. > I have a table as : clob(id integer PK,clobval clob NN) > Now I try to insert some data in it: > >>longString="abcd"*2500 > >>cur=con.cursor() > >>cur.setinputsizes(pstr=cx_Oracle.LONG_STRING) > >>cur.execute("insert into testclob values(:pint,:pstr)",pint=1,pstr=longString) > > But here I gets error: > cx_Oracle.DatabaseError: ORA-01461: can bind a LONG value only for insert into a LONG column > > Please Help.. > > I am using Python 2.3/cx_Oracle 3.1/ Oracle 8.1.5 on Windows 2k (SP4). > > TIA and Kind Regards, > Vivek Kumar > > > ------------------------------------------------------- > This sf.net email is sponsored by:ThinkGeek > Welcome to geek heaven. > http://thinkgeek.com/sf > _______________________________________________ > cx-oracle-users mailing list > cx-...@li... > https://lists.sourceforge.net/lists/listinfo/cx-oracle-users -- Anthony Tuininga an...@co... Computronix Distinctive Software. Real People. Suite 200, 10216 - 124 Street NW Edmonton, AB, Canada T5N 4A3 Phone: (780) 454-3700 Fax: (780) 454-3838 http://www.computronix.com |