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?
Extra info:
OS - SuSE Linux 9.2
Client - Oracle Client 9.2.0.1.0
NLS_LANG="RUSSIAN_CIS.UTF8"
--
Best regards, Maxim Kuleshov 1 4395
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. This thread has been closed and replies have been disabled. Please start a new discussion. Similar topics |
by: Bryan J Gudorf |
last post by:
PDO, an open source python module for interfacing with RDBMS (SQL
databases), has now reached 1.2.0! PDO provides an object oriented API,
similar to that of ADO or JDBC, to python developers. PDO...
|
by: vb_bv |
last post by:
Does Pyton PL/SQL programming language of Oracle support?
Thx
|
by: hot.favorite |
last post by:
Hi,
I'm fairly new to Python so please pardon any dumbness on my part.
I plan to write an app in Python that will run on Linux and would need
to connect to Oracle and MySQL. I could use...
|
by: dananrg |
last post by:
I'm a little confused about what's out there for database modules at:
http://python.org/topics/database/modules.html
What I'd like to do is use Python to access an Oracle 9.X database for...
|
by: cirudinezidane |
last post by:
Hi!!
I'd like to install Oracle 10 g express edition over Ubuntu to use with
Python 2.4. I have installed Ubuntu, Python 2.4 and Oracle database. I
think that I have installed correctly...
| |
by: Richard Schulman |
last post by:
Sorry to be back at the goodly well so soon, but...
....when I execute the following -- variable mean_eng_txt being
utf-16LE and its datatype nvarchar2(79) in Oracle:
cursor.execute("""INSERT...
|
by: M.-A. Lemburg |
last post by:
On 2008-04-30 18:42, Sean Ryan wrote:
The -v option only causes Python to print more information to
stderr explaining where it is looking for modules.
You should be seeing any dynamic loader...
|
by: mh |
last post by:
I'm pleased to announce the initial release of OraPIG,
the Oracle Python Interface Generator.
OraPIG generates Python wrapper classes for Oracle packages.
If you use Oracle and Python, this...
|
by: Raja |
last post by:
Hi,
I am trying to write a cgi program which would be executed on
browser with Apache server installed.
The program would make a connection to a database using cx_Oracle
module and display...
|
by: harshakusam |
last post by:
Hi All,
In my python script i use to run some oracle queries for this i require a library to connect to oracle which is cx_Oracle.
When we were using 9i(oracle).. my script was running fine.....
|
by: Hystou |
last post by:
Most computers default to English, but sometimes we require a different language, especially when relocating. Forgot to request a specific language before your computer shipped? No problem! You can...
| |
by: Hystou |
last post by:
Overview:
Windows 11 and 10 have less user interface control over operating system update behaviour than previous versions of Windows. In Windows 11 and 10, there is no way to turn off the Windows...
|
by: tracyyun |
last post by:
Dear forum friends,
With the development of smart home technology, a variety of wireless communication protocols have appeared on the market, such as Zigbee, Z-Wave, Wi-Fi, Bluetooth, etc. Each...
|
by: agi2029 |
last post by:
Let's talk about the concept of autonomous AI software engineers and no-code agents. These AIs are designed to manage the entire lifecycle of a software development project—planning, coding, testing,...
|
by: conductexam |
last post by:
I have .net C# application in which I am extracting data from word file and save it in database particularly. To store word all data as it is I am converting the whole word file firstly in HTML and...
|
by: TSSRALBI |
last post by:
Hello
I'm a network technician in training and I need your help.
I am currently learning how to create and manage the different types of VPNs and I have a question about LAN-to-LAN VPNs.
The...
|
by: adsilva |
last post by:
A Windows Forms form does not have the event Unload, like VB6. What one acts like?
| |
by: muto222 |
last post by:
How can i add a mobile payment intergratation into php mysql website.
|
by: bsmnconsultancy |
last post by:
In today's digital era, a well-designed website is crucial for businesses looking to succeed. Whether you're a small business owner or a large corporation in Toronto, having a strong online presence...
| | |