On 03/12/10 17:29, Ian wrote:
On Dec 2, 3:17 pm, Tim Sawyer<list.dja...@calidris.co.uk> wrote:
I unpatched mine (changed LIKEC to LIKE) and then ran:
>>> from django.db import connection
>>> cursor = connection.cursor()
>>> result = cursor.execute(r"SELECT 1 FROM DUAL WHERE TRANSLATE('A'
USING NCHAR_CS) LIKE TRANSLATE('A' USING NCHAR_CS) ESCAPE TRANSLATE('\'
USING NCHAR_CS)")
>>> rows = cursor.fetchall()
>>> for row in rows:
> ... print row[0]
> ...
> 1
>>> print rows
> ((1,),)
Nuts. What if you remove the first TRANSLATE call, i.e.
cursor.execute(r"SELECT 1 FROM DUAL WHERE 'A' LIKE TRANSLATE('A' USING
NCHAR_CS) ESCAPE TRANSLATE('\' USING NCHAR_CS)")
If that also doesn't trigger the error, then maybe we need an actual
column in the mix. Please try this also:
cursor.execute(r"SELECT 1 FROM DUAL WHERE DUMMY LIKE TRANSLATE('X'
USING NCHAR_CS) ESCAPE TRANSLATE('\' USING NCHAR_CS)")
Thanks,
Ian
Oracle is very weird sometimes.
>>> from django.db import connection
>>> cursor = connection.cursor()
>>> result = cursor.execute(r"SELECT 1 FROM DUAL WHERE 'A'
LIKE TRANSLATE('A' USING NCHAR_CS) ESCAPE TRANSLATE('\' USING
NCHAR_CS)")
>>> rows = cursor.fetchall()
>>> for row in rows:
... print row[0]
...
1
>>> print rows
((1,),)
>>> result = cursor.execute(r"SELECT 1 FROM DUAL WHERE DUMMY
LIKE TRANSLATE('X' USING NCHAR_CS) ESCAPE TRANSLATE('\' USING
NCHAR_CS)")
Traceback (most recent call last):
File "<console>", line 1, in<module>
File
"/dev/HEAD/BESPOKE/app/websites/app\django\db\backends\util.py", line
15, in execute
return self.cursor.execute(sql, params)
File
"/dev/HEAD/BESPOKE/app/websites/app\django\db\backends\oracle\base.py",
line 507, in execute
return self.cursor.execute(query, self._param_generator(params))
DatabaseError: ORA-01425: escape character must be character string of
length 1
Tim.
--
You received this message because you are subscribed to the Google Groups "Django
users" group.
To post to this group, send email to django-us...@googlegroups.com.
To unsubscribe from this group, send email to
django-users+unsubscr...@googlegroups.com.
For more options, visit this group at
http://groups.google.com/group/django-users?hl=en.