[cx-oracle-users] ORA-01461 when inserting into VARCHAR2 column
Brought to you by:
atuining
From: Rodney B. <ba...@pl...> - 2011-05-23 17:12:06
|
I typically use cx_Oracle via SQLAlchemy and had trouble providing Unicode variables to an insert statement. They redirected me here. While preparing a test case, I found the problem to be a bit different than I expected. I'm finding cases where inserting a string (via bind variable) with length > 2000 into a VARCHAR2 column fails with "ORA-01461: can bind a LONG value only for insert into a LONG column". In my test case, this happens when the first insert uses a unicode bind variable (not necessarily > 2000 in length). Subsequent inserts using either str or unicode bind variables > 2000 in length fail with ORA-01461. If the first insert uses a str bind variable, subsequent inserts succeed with either str or unicode. If this is expected behavior, is there a setting that can be used to avoid the problem? Some system specifics: Oracle version : 10gXE Database characterset: AL32UTF8 NLS_LANG variable : AMERICAN_AMERICA.AL32UTF8 cx_Oracle version : 5.1 python version : 2.6 Rodney |