Opened 9 years ago

Closed 9 years ago

Last modified 8 years ago

#13076 closed (invalid)

Oracle backend: Error ORA-01036 when using extra() with params

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


The extra function on query_set give an error when using it with "params" (using Oracle 9i, cx_Oracle 5.0.2).

MyModel.objects.extra(where=["DESCRIPTION like '%s'"], params=["something"])


DatabaseError: ORA-01036: illegal variable name/number

Note: the following works

MyModel.objects.extra(where=["DESCRIPTION like 'something'"])

Change History (2)

comment:1 Changed 9 years ago by Karen Tracey

Resolution: invalid
Status: newclosed

Don't attempt to do your own quoting in the where clause when you are supplying parameters. That is, remove the quotes around '%s'; the backend will handle quoting and any escaping necessary for the parameters you pass. See:

comment:2 Changed 8 years ago by Jacob

milestone: 1.2

Milestone 1.2 deleted

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