Skip to content
This repository has been archived by the owner on May 5, 2020. It is now read-only.

Inserting a timestamp value loses the fractional second #121

Closed
ravikumars opened this issue Nov 12, 2018 · 2 comments
Closed

Inserting a timestamp value loses the fractional second #121

ravikumars opened this issue Nov 12, 2018 · 2 comments

Comments

@ravikumars
Copy link

I am inserting a timestamp value into an oracle database with Column as TIMESTAMP(6).
e.g.
SRB_RECEIVE_DATE := time.Now(); stmt, err := db.Prepare("INSERT INTO {table}(srb_receive_date) values(:1)"); stm.Exec(SRB_RECEIVE_DATE)

The record is inserted but the fractional part is all zeroes
image

The SRB_RECEIVE_DATE itself has the nanosecond part.

Any idea why?

@tgulacsi
Copy link
Contributor

goracle uses DATE inside, which does not have fractional second precision.
The reason is that I couldn't make it work with TIMESTAMP PL/SQL arrays.

@ravikumars
Copy link
Author

Thanks for the update. I am using the timestamp formatted to string and passing on to be inserted.
e.g.
SRB_RECEIVE_DATE = time.Now().Format("2-Jan-06 3:04:05.000000 PM")

Works as expected.

Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants