Opened 15 years ago

Last modified 14 years ago

#13436 closed

oracle startswith etc fails — at Version 2

Reported by: kthhrv Owned by: nobody
Component: Database layer (models, ORM) Version: 1.2
Severity: Keywords: oracle
Cc: Triage Stage: Unreviewed
Has patch: no Needs documentation: no
Needs tests: no Patch needs improvement: no
Easy pickings: no UI/UX: no

Description (last modified by Karen Tracey)

OracleDBModel.objects.filter(name__startswith='abc')

DatabaseError: ORA-01425: escape character must be character string of length 1

changing
django/db/backends/oracle/base.py

-'startswith': "LIKE TRANSLATE(%s USING NCHAR_CS) ESCAPE TRANSLATE('\\' USING NCHAR_CS)",
+'startswith': "LIKE %s ESCAPE '\\'",

appears to fix the problem

Change History (2)

comment:1 by kthhrv, 15 years ago

Version: 1.1-beta-11.2-beta

initial post stole my formatting

OracleDBModel.objects.filter(namestartswith='abc')

DatabaseError?: ORA-01425: escape character must be character string of length 1

changing django/db/backends/oracle/base.py
-'startswith': "LIKE TRANSLATE(%s USING NCHAR_CS) ESCAPE TRANSLATE('
' USING NCHAR_CS)",
+'startswith': "LIKE %s ESCAPE '
'", appears to fix the problem

comment:2 by Karen Tracey, 15 years ago

Description: modified (diff)

Fixed formatting. Please use WikiFormatting and Preview before hitting Submit.

Note: See TracTickets for help on using tickets.
Back to Top