Re: [cx-oracle-users] python 2.3.4 + cx_oracle 4.1 + utf-8 error
Brought to you by:
atuining
From: Anthony T. <ant...@gm...> - 2005-05-17 19:37:18
|
I'm not surprised. With CLOB values, this problem can be avoided but with varchar2 columns the size is in __bytes__ not characters so you need to increase the size of your columns appropriately -- at least that's my understanding from reading Oracle's manuals. If you have something that suggests otherwise I'd be happy to read it. :-) I've made the necessary adjustment for CLOB values with UTF-8 (and other character sets) in cx_Oracle 4.1 and I haven't heard any complaints so I guess I got it right. I didn't put a similar thing on varchar2 columns because of the constraint noted above. Hope that helps. On 5/12/05, Maxim Kuleshov <kul...@cs...> wrote: > Hello! >=20 > Trying to fetch long varchar2 column and get the following error: >=20 > cx_Oracle.DatabaseError: column at array pos 0 fetched with error: 1406 >=20 > i.e. string buffer is not much enough to fetch the string. >=20 > # fragment of code... > myCon =3D cx_Oracle.connect(user, psw, dsn) > myCur =3D myCon.cursor() > myCur.execute(""" > select COLUMN from TABLE where ID=3D1 > """) > for record in myCur.fetchall(): > # ... >=20 > Error is reproduced only if actual string value longer than half of > declared column size. For short strings all is ok. >=20 > If I print myCur.description, I get: >=20 > [('COLUMN', <type 'cx_Oracle.STRING'>, 250, 250, 0, 0, 1)] >=20 > 250 - declared column max size, but I guess cx_Oracle allocates only 250 > bytes(!), so if my string longer than 125 chars (utf-8 national char > occupies > 1 byte) - I get the error. >=20 > Is it bug or what? Any suggestions? >=20 > Extra info: > OS - SuSE Linux 9.2 > Client - Oracle Client 9.2.0.1.0 > NLS_LANG=3D"RUSSIAN_CIS.UTF8" >=20 > -- > Best regards, > Maxim Kuleshov >=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=3D7393&alloc_id=3D16281&op=3Dclick > _______________________________________________ > cx-oracle-users mailing list > cx-...@li... > https://lists.sourceforge.net/lists/listinfo/cx-oracle-users > |