mattn / go-oci8

Oracle driver for Go using database/sql
https://mattn.kaoriya.net/
MIT License
630 stars 212 forks source link

Querying sequence with big number returns 0 #282

Closed whoilo closed 5 years ago

whoilo commented 5 years ago

If you have a SEQ with current value for example 30000 is ok, but if 30000000 you will get 0 in nextId. Code with commit date older than 27 july 2018 works fine.

rows, _ := connection.QueryContext(ctx, "SELECT SEQ.NEXTVAL FROM DUAL")

var nextId int64

for rows.Next() {

    rows.Scan(&nextId)
}
MichaelS11 commented 5 years ago

Working on test cases for this now, so far not seen any issues. Can you please try this in SQL Plus and post the results? Also, please post your full create statement for your sequence.

whoilo commented 5 years ago

Unfortunately i cannot reproduce this in SQL*Plus because i never use it. I can only say it did not work in latest release i downloaded a week ago. So chose last working commit for me and downloaded as zip: go-oci8-e93f3e58bcb5be7ef81ff74133fab25be6153c2d.zip

whoilo commented 5 years ago

CREATE SEQUENCE "AGENCY_TEST"."S_TELEX_1" MINVALUE 38999999 MAXVALUE 9999999999999999999999999999 INCREMENT BY 1 START WITH 39000045 NOCACHE NOORDER NOCYCLE

here is my test sequence

MichaelS11 commented 5 years ago

Added sequence tests: https://github.com/mattn/go-oci8/pull/286

They all passed. Far as I can tell driver is fine.

The problem you are having could be located elsewhere. If you still think it is a driver issue going to need more, like SQL Plus testing and full test case/code/SQL.

MichaelS11 commented 5 years ago

Close this?

whoilo commented 5 years ago

I think yes