Re: [cx-oracle-users] Re: Inserting on table where is CLOB column
Brought to you by:
atuining
|
From: Anthony T. <ant...@gm...> - 2005-05-17 19:26:51
|
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 col=
umn.
> >>
> >>It should be CLOB instead of LONG. Is there way to get around this prob=
lem?
> >>
> >>When value is less than 4000 chars inserts goes well, but after breakin=
g
> >>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 =3D cx_Oracle.Connection("user/pw@tns")
> > cursor =3D connection.cursor()
> > cursor.setinputsizes(value =3D cx_Oracle.CLOB)
> > cursor.execute("insert into table values (:value)",
> > value =3D "A very long string")
>=20
> Didn't saw that in list. It would solve my problem if I knew queries
> before, but...
>=20
> Problem is that I haven't got control over bindings since code is
> basically just code below:
>=20
> 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().
> Any ideas?
>=20
> --
>=20
> Jani Tiainen
>=20
>=20
> -------------------------------------------------------
> This SF.Net email is sponsored by Oracle Space Sweepstakes
> Want to be the first software developer in space?
> Enter now for the Oracle Space Sweepstakes!
> http://ads.osdn.com/?ad_id=3D7412&alloc_id=3D16344&op=3Dclick
> _______________________________________________
> cx-oracle-users mailing list
> cx-...@li...
> https://lists.sourceforge.net/lists/listinfo/cx-oracle-users
>
|