Maxim Kuleshov wrote: > Hello! > > Trying to fetch long varchar2 column and get the following error: > > cx_Oracle.DatabaseError: column at array pos 0 fetched with error: 1406 > > i.e. string buffer is not much enough to fetch the string. > > # fragment of code... > myCon = cx_Oracle.connect(user, psw, dsn) > myCur = myCon.cursor() > myCur.execute(""" > select COLUMN from TABLE where ID=1 > """) > for record in myCur.fetchall(): > # ... > > Error is reproduced only if actual string value longer than half of > declared column size. For short strings all is ok. > > If I print myCur.description, I get: > > [('COLUMN', <type 'cx_Oracle.STRING'>, 250, 250, 0, 0, 1)] > > 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. > > Is it bug or what? Any suggestions?
Googling for "varchar2 utf-8" suggests that it's an Oracle's feature (or issue). varchar2 is allocated in bytes. Finding out the largest number of bytes per character is left as an exercise :) Sergey. -- http://mail.python.org/mailman/listinfo/python-list