[cx-oracle-users] Re: Inserting on table where is CLOB column
Brought to you by:
atuining
From: Jani T. <re...@lu...> - 2005-05-17 19:46:37
|
Anthony Tuininga kirjoitti: > On 5/17/05, Jani Tiainen <re...@lu...> wrote: > >>Charl P. Botha kirjoitti: >> >>>On 5/17/05, Jani Tiainen <re...@lu...> wrote: >>> >>> >>>>When I'm trying to insert long text in CLOB column I get error >>>>ORA-01461. Something like LONG value can be only to be bind in LONG column. >>>> >>>>It should be CLOB instead of LONG. Is there way to get around this problem? >>>> >>>>When value is less than 4000 chars inserts goes well, but after breaking >>>>barrier problem occurs. >>>> >>>>Using cx_Oracle 4.1 with Python 2.3, Windows XP, Oracle 10g >>> >>> >>>It looks like you have to use bind variables. This is from an example >>>Anthony posted on this list to answer one of my questions: >>> >>>connection = cx_Oracle.Connection("user/pw@tns") >>>cursor = connection.cursor() >>>cursor.setinputsizes(value = cx_Oracle.CLOB) >>>cursor.execute("insert into table values (:value)", >>> value = "A very long string") >> >>Didn't saw that in list. It would solve my problem if I knew queries >>before, but... >> >>Problem is that I haven't got control over bindings since code is >>basically just code below: >> >>def runquery(cursor, query, args): >> return cursor.execute(query, args) > > > The args __are__ the bind variables so you definitely have control. > You simply have to make sure you call cursor.setinputsizes() before > calling runquery(). Well, they are, but I don't have control over them.. :) Since same call in code is used for different database backends (like Postgres) This is somewhat possible to fix in current situation since I know that strings that are > 4k must be clobs... -- Jani Tiainen |