Closed 242617 closed 6 years ago
I've losing float part in sum(). Example:
sum()
package main import ( "database/sql" "fmt" _ "github.com/mattn/go-oci8" //oci8 _ "gopkg.in/goracle.v2" //goracle _ "gopkg.in/rana/ora.v4" //ora ) const query = ` SELECT SUM(BALANCE) FROM ( SELECT 123.123 BALANCE FROM DUAL ) ` func main() { fmt.Printf("%s: %f\n", "oci8", db("oci8")) fmt.Printf("%s: %f\n", "goracle", db("goracle")) fmt.Printf("%s: %f\n", "ora", db("ora")) } func db(framework string) (number float64) { db, err := sql.Open(framework, "...") die(err) err = db.QueryRow(query).Scan(&number) die(err) return } func die(err error) { if err != nil { panic(err) } }
The result is
oci8: 123.000000 goracle: 123.123000 ora: 123.123000
Oracle Database 11g Enterprise Edition 11.2.0.4.0 - 64bit Production.
This is an issue with number scale (type) for numbers. Have PR https://github.com/mattn/go-oci8/pull/268 open for it. Will see what @mattn thinks.
@242617 Please test
Works perfect. Thank you!
Thanks.
I've losing float part in
sum()
. Example:The result is
Oracle Database 11g Enterprise Edition 11.2.0.4.0 - 64bit Production.