ORA-01843: Not a Valid Month in go xorm 1.0.1 #1641

Open
opened 2020-04-01 09:48:17 +00:00 by anshulagg2705 · 6 comments

We are using go xorm with Oracle 12c. We are using library version 0.6.1 and trying to upgrade to version 1.0.1.

We notice timestamp format has changed in version 1.0.1 and Oracle throws error
ORA-01843: Not a Valid Month due to invalid timestamp format.

Go field type - time.Time xorm:""

Oracle column type - TIMESTAMP(6)

We set engine.ShowSQL(true) and notice timestamp format has changed in SQL -

version 0.6.1 - 2020-04-01 14:50:31.638518 +0530 IST m=+8.824813982

version 1.0.1 - 2020-04-01T14:31:35

We tried using below xorm types but Oracle throws error ORA-01843: Not a Valid Month for all.

time.Time xorm:"" - 2020-04-01T14:31:35

time.Time xorm:"TIMESTAMP" - 2020-04-01T14:31:35

time.Time xorm:"TIMESTAMPZ" - 2020-04-01T14:31:35.313203+05:30

We are using go xorm with `Oracle 12c`. We are using library `version 0.6.1` and trying to upgrade to `version 1.0.1`. We notice timestamp format has changed in `version 1.0.1` and Oracle throws error `ORA-01843: Not a Valid Month` due to invalid timestamp format. **Go field type** - time.Time `xorm:""` **Oracle column type** - TIMESTAMP(6) We set engine.ShowSQL(true) and notice timestamp format has changed in SQL - **version 0.6.1** - `2020-04-01 14:50:31.638518 +0530 IST m=+8.824813982` **version 1.0.1** - `2020-04-01T14:31:35` We tried using below xorm types but Oracle throws error `ORA-01843: Not a Valid Month` for all. time.Time `xorm:""` - `2020-04-01T14:31:35` time.Time `xorm:"TIMESTAMP"` - `2020-04-01T14:31:35` time.Time `xorm:"TIMESTAMPZ"` - `2020-04-01T14:31:35.313203+05:30`

I have the same issue. Can someone let me know how to fix it.

I have the same issue. Can someone let me know how to fix it.
lunny added the
kind
bug
label 2020-04-01 12:38:12 +00:00
Owner

@anshulagg2705 and @dwa3092 which version are you using? And could you help to confirm #1463 fixed your problem?

@anshulagg2705 and @dwa3092 which version are you using? And could you help to confirm #1463 fixed your problem?
Contributor

it works fine for inserting ,but not for updating. UPDATE T_API_KEY SET status = :1, update_time = :2 WHERE key_id=:3 [1 2020-05-26 17:44:55 b04f4396-0883-43d0-9d9f-61318910810e]

it works fine for inserting ,but not for updating. `UPDATE T_API_KEY SET status = :1, update_time = :2 WHERE key_id=:3 [1 2020-05-26 17:44:55 b04f4396-0883-43d0-9d9f-61318910810e]`
Contributor

I found the issue: session_update.go line 208 should be modified: if session.engine.dialect.URI().DBType == schemas.ORACLE { args = append(args, t) } else { args = append(args, val) }

I found the issue: session_update.go line 208 should be modified:` if session.engine.dialect.URI().DBType == schemas.ORACLE { args = append(args, t) } else { args = append(args, val) }`
Owner

@getsu Please send a PR to fix that.

@getsu Please send a PR to fix that.
Contributor
@lunny https://gitea.com/xorm/xorm/pulls/1694
lunny added the
db
oracle
label 2020-06-04 01:28:53 +00:00
Sign in to join this conversation.
No Milestone
No Assignees
4 Participants
Notifications
Due Date
The due date is invalid or out of range. Please use the format 'yyyy-mm-dd'.

No due date set.

Dependencies

No dependencies set.

Reference: xorm/xorm#1641
No description provided.