ORACLE - column at array pos 0 fetched with error: 1406

412 views
Skip to first unread message

Tristan

unread,
Mar 21, 2007, 10:09:12 PM3/21/07
to Django developers
I am under 4697 of http://code.djangoproject.com/svn/django/branches/boulder-oracle-sprint/
Before reporting this message as a ticked, I would like to be sure if
it is my mistake or a bug exists.
Into an x model, I defined next field:
caracter = models.CharField('Campo Character',
maxlength=10)
When I attemp to enter next data to this field in the Admin I have
next situations:
áéíóú = No problem
áéíóúa = System generates mentioned error (ORA 1406) but
complete data is saved.
áéíóaa = No problem
á¿567890 = No problem
1234567890 = No problem.
á¿5678901 = System generates mentioned error (ORA 1406) but
complete data is saved. See related error for this data below.
What I identified is that when using characters such as á, é, ¿, etc.
system seems to use two (2) characters or positions. Although data was
saved, I can not access to any record when browsing with Django. When
inserting/changing using sqlplus command, I have no problems during
commit and during query.
My Oracle variable NLS_LANG=.UTF8 and use Windows XP2.


Part of the data where error occurs is:

# or checking the Model here, neither of which is
good.
elif isinstance(field, datetime.datetime) and \
field.hour == field.minute == field.second ==
field.microsecond == 0:
yield field.date()
else:
yield field
for unresolved_row in cursor:
row = list(resolve_cols(unresolved_row))
if fill_cache:
obj, index_end = get_cached_row(self.model, row,
0)
else:
obj = self.model(*row[:index_end])
for i, k in enumerate(extra_select):
▼ Local vars
Variable Value
cursor <django.db.backends.oracle.base.FormatStylePlaceholderCursor on
<cx_Oracle.Connection to mix@CORD>>
extra_select []
fill_cache False
full_query 'SELECT "TESTDB_DBTEST"."ID", "TESTDB_DBTEST"."FECHA",
"TESTDB_DBTEST"."CARACTER", "TESTDB_DBTEST"."TEXTO",
"TESTDB_DBTEST"."MONTO"\n FROM "TESTDB_DBTEST" ORDER BY
"TESTDB_DBTEST"."FECHA" ASC'
get_cached_row <function get_cached_row at 0x013D1AB0>
index_end 5
params []
resolve_cols <function resolve_cols at 0x06EA56F0>
select ['"TESTDB_DBTEST"."ID"', '"TESTDB_DBTEST"."FECHA"',
'"TESTDB_DBTEST"."CARACTER"', '"TESTDB_DBTEST"."TEXTO"',
'"TESTDB_DBTEST"."MONTO"']
self Error in formatting:column at array pos 0 fetched with error:
1406
sql ' FROM "TESTDB_DBTEST" ORDER BY "TESTDB_DBTEST"."FECHA" ASC'

Tristan.

Masida

unread,
Mar 23, 2007, 1:39:01 PM3/23/07
to Django developers
Hi Tristan,

Unfortunately, cx_Oracle - and therefore Django/Oracle - doesn't
support UTF-8 yet.

What works for setting your environment to Latin1/ISO8859 (with
os.environ['NLS_LANG'] = 'American_America.WE8ISO8859P1'). If you make
sure you're whole website uses ISO8859 then Oracle will translate it
correctly to whatever character set your database uses (probably
UTF-8).

It's far from ideal, but it works.

Ciao,
- Matthias

Reply all
Reply to author
Forward
Message has been deleted
0 new messages