Opened 16 years ago

Closed 16 years ago

Last modified 13 years ago

#9275 closed Uncategorized (fixed)

ORA-01830 date format picture ends before converting entire input... admin

Reported by: hollerith Owned by: nobody
Component: Database layer (models, ORM) Version: 1.0
Severity: Normal Keywords: oracle date formats
Cc: Erin Kelly, Matt Boersma Triage Stage: Unreviewed
Has patch: yes Needs documentation: no
Needs tests: no Patch needs improvement: no
Easy pickings: no UI/UX: no

Description

Doing: Porting a legacy application on Oracle 10g.
Symptom: The admin change interface reported this error on Datetimefields.
Solution:I found the 'works for me' at least was to alter the NLS_DATE_FORMAT in backend/oracle/base.py to include the time in the correct format to match django format (i.e. no fractions).

Attachments (2)

base.diff (186 bytes ) - added by hollerith@… 16 years ago.
basic diff
base.2.diff (186 bytes ) - added by hollerith <sp4me4ter@…> 16 years ago.

Download all attachments as: .zip

Change History (6)

by hollerith@…, 16 years ago

Attachment: base.diff added

basic diff

by hollerith <sp4me4ter@…>, 16 years ago

Attachment: base.2.diff added

comment:1 by hollerith <sp4me4ter@…>, 16 years ago

Both files are the same:

429c429
< cursor.execute("ALTER SESSION SET NLS_DATE_FORMAT = 'YYYY-MM-DD' "
---

cursor.execute("ALTER SESSION SET NLS_DATE_FORMAT = 'YYYY-MM-DD HH24:MI:SS' "

comment:2 by Matt Boersma, 16 years ago

Cc: Erin Kelly Matt Boersma added

comment:3 by Erin Kelly, 16 years ago

Resolution: fixed
Status: newclosed

(In [9780]) [1.0.X] Fixed #9275: Extended the Oracle date format to allow DATE columns to be used with DateTimeFields, especially when using legacy databases. Thanks to hollerith for the patch. Backport of [9779] from trunk.

comment:4 by anurag.chourasia@…, 13 years ago

Easy pickings: unset
Severity: Normal
Type: Uncategorized
UI/UX: unset

If the issue still persists and If the model field is a DateTimeField and the Database field is of DATE Type then you could try this to overcome this error

Look for the statement where you are updating the Date field. Over there, replace the microseonds to Zero and Oracle will start treating it gracefully.

For example, if you model field is called date_field

and if you are updating it as

date_field=datetime.datetime.now()

then change it to

date_field=datetime.datetime.now().replace(microsecond=0)

And that will solve the issue

Regards
Guddu

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