{"action":"closed","issue":{"url":"https://api.github.com/repos/rana/ora/issues/112","repository_url":"https://api.github.com/repos/rana/ora","labels_url":"https://api.github.com/repos/rana/ora/issues/112/labels{/name}","comments_url":"https://api.github.com/repos/rana/ora/issues/112/comments","events_url":"https://api.github.com/repos/rana/ora/issues/112/events","html_url":"https://github.com/rana/ora/issues/112","id":169649864,"number":112,"title":"Problem in num/ocinum.go for value 0.009375.","user":{"login":"petri-vesanen","id":8286866,"avatar_url":"https://avatars.githubusercontent.com/u/8286866?v=3","gravatar_id":"","url":"https://api.github.com/users/petri-vesanen","html_url":"https://github.com/petri-vesanen","followers_url":"https://api.github.com/users/petri-vesanen/followers","following_url":"https://api.github.com/users/petri-vesanen/following{/other_user}","gists_url":"https://api.github.com/users/petri-vesanen/gists{/gist_id}","starred_url":"https://api.github.com/users/petri-vesanen/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/petri-vesanen/subscriptions","organizations_url":"https://api.github.com/users/petri-vesanen/orgs","repos_url":"https://api.github.com/users/petri-vesanen/repos","events_url":"https://api.github.com/users/petri-vesanen/events{/privacy}","received_events_url":"https://api.github.com/users/petri-vesanen/received_events","type":"User","site_admin":false},"labels":[],"state":"closed","locked":false,"assignee":null,"assignees":[],"milestone":null,"comments":1,"created_at":"2016-08-05T16:50:56Z","updated_at":"2016-09-15T10:40:42Z","closed_at":"2016-09-15T10:40:42Z","body":"It seems that if we have a table with a column of type NUMBER (30, 15) having value 0.009375, Scan method returns 0.9375 into float64.\r\n\r\nSee this pull request:\r\nhttps://github.com/rana/ora/pull/111\r\n\r\nThere may be a similar problem in SetString method because Oracle documentation says \"The mantissa is normalized; leading zeroes are not stored.\".\r\n\r\nTest case:\r\n\r\n```sql\r\nCREATE TABLE TEST_DIGITS (ID INTEGER, X NUMBER (30, 15))\r\n\r\nINSERT ALL\r\n        INTO TEST_DIGITS (ID, X) VALUES (1, 5)\r\n        INTO TEST_DIGITS (ID, X) VALUES (2, 50)\r\n        INTO TEST_DIGITS (ID, X) VALUES (3, 500)\r\n        INTO TEST_DIGITS (ID, X) VALUES (4, 5000)\r\n        INTO TEST_DIGITS (ID, X) VALUES (5, 50000)\r\n        INTO TEST_DIGITS (ID, X) VALUES (6, 500000)\r\n        INTO TEST_DIGITS (ID, X) VALUES (7, 5000000)\r\n        INTO TEST_DIGITS (ID, X) VALUES (8, 55)\r\n        INTO TEST_DIGITS (ID, X) VALUES (9, 550)\r\n        INTO TEST_DIGITS (ID, X) VALUES (10, 5500)\r\n        INTO TEST_DIGITS (ID, X) VALUES (11, 55000)\r\n        INTO TEST_DIGITS (ID, X) VALUES (12, 550000)\r\n        INTO TEST_DIGITS (ID, X) VALUES (13, 5500000)\r\n        INTO TEST_DIGITS (ID, X) VALUES (14, 55000000)\r\n        INTO TEST_DIGITS (ID, X) VALUES (15, 555)\r\n        INTO TEST_DIGITS (ID, X) VALUES (16, 5550)\r\n        INTO TEST_DIGITS (ID, X) VALUES (17, 55500)\r\n        INTO TEST_DIGITS (ID, X) VALUES (18, 555000)\r\n        INTO TEST_DIGITS (ID, X) VALUES (19, 5550000)\r\n        INTO TEST_DIGITS (ID, X) VALUES (20, 55500000)\r\n        INTO TEST_DIGITS (ID, X) VALUES (21, 555000000)\r\n        INTO TEST_DIGITS (ID, X) VALUES (22, 5555)\r\n        INTO TEST_DIGITS (ID, X) VALUES (23, 55550)\r\n        INTO TEST_DIGITS (ID, X) VALUES (24, 555500)\r\n        INTO TEST_DIGITS (ID, X) VALUES (25, 5555000)\r\n        INTO TEST_DIGITS (ID, X) VALUES (26, 55550000)\r\n        INTO TEST_DIGITS (ID, X) VALUES (27, 555500000)\r\n        INTO TEST_DIGITS (ID, X) VALUES (28, 5555000000)\r\n        INTO TEST_DIGITS (ID, X) VALUES (29, 55555)\r\n        INTO TEST_DIGITS (ID, X) VALUES (30, 555550)\r\n        INTO TEST_DIGITS (ID, X) VALUES (31, 5555500)\r\n        INTO TEST_DIGITS (ID, X) VALUES (32, 55555000)\r\n        INTO TEST_DIGITS (ID, X) VALUES (33, 555550000)\r\n        INTO TEST_DIGITS (ID, X) VALUES (34, 5555500000)\r\n        INTO TEST_DIGITS (ID, X) VALUES (35, 55555000000)\r\n        INTO TEST_DIGITS (ID, X) VALUES (36, 0.5)\r\n        INTO TEST_DIGITS (ID, X) VALUES (37, 0.05)\r\n        INTO TEST_DIGITS (ID, X) VALUES (38, 0.005)\r\n        INTO TEST_DIGITS (ID, X) VALUES (39, 0.0005)\r\n        INTO TEST_DIGITS (ID, X) VALUES (40, 0.00005)\r\n        INTO TEST_DIGITS (ID, X) VALUES (41, 0.000005)\r\n        INTO TEST_DIGITS (ID, X) VALUES (42, 0.0000005)\r\n        INTO TEST_DIGITS (ID, X) VALUES (43, 0.55)\r\n        INTO TEST_DIGITS (ID, X) VALUES (44, 0.055)\r\n        INTO TEST_DIGITS (ID, X) VALUES (45, 0.0055)\r\n        INTO TEST_DIGITS (ID, X) VALUES (46, 0.00055)\r\n        INTO TEST_DIGITS (ID, X) VALUES (47, 0.000055)\r\n        INTO TEST_DIGITS (ID, X) VALUES (48, 0.0000055)\r\n        INTO TEST_DIGITS (ID, X) VALUES (49, 0.00000055)\r\n        INTO TEST_DIGITS (ID, X) VALUES (50, 0.555)\r\n        INTO TEST_DIGITS (ID, X) VALUES (51, 0.0555)\r\n        INTO TEST_DIGITS (ID, X) VALUES (52, 0.00555)\r\n        INTO TEST_DIGITS (ID, X) VALUES (53, 0.000555)\r\n        INTO TEST_DIGITS (ID, X) VALUES (54, 0.0000555)\r\n        INTO TEST_DIGITS (ID, X) VALUES (55, 0.00000555)\r\n        INTO TEST_DIGITS (ID, X) VALUES (56, 0.000000555)\r\n        INTO TEST_DIGITS (ID, X) VALUES (57, 0.5555)\r\n        INTO TEST_DIGITS (ID, X) VALUES (58, 0.05555)\r\n        INTO TEST_DIGITS (ID, X) VALUES (59, 0.005555)\r\n        INTO TEST_DIGITS (ID, X) VALUES (60, 0.0005555)\r\n        INTO TEST_DIGITS (ID, X) VALUES (61, 0.00005555)\r\n        INTO TEST_DIGITS (ID, X) VALUES (62, 0.000005555)\r\n        INTO TEST_DIGITS (ID, X) VALUES (63, 0.0000005555)\r\n        INTO TEST_DIGITS (ID, X) VALUES (64, 0.55555)\r\n        INTO TEST_DIGITS (ID, X) VALUES (65, 0.055555)\r\n        INTO TEST_DIGITS (ID, X) VALUES (66, 0.0055555)\r\n        INTO TEST_DIGITS (ID, X) VALUES (67, 0.00055555)\r\n        INTO TEST_DIGITS (ID, X) VALUES (68, 0.000055555)\r\n        INTO TEST_DIGITS (ID, X) VALUES (69, 0.0000055555)\r\n        INTO TEST_DIGITS (ID, X) VALUES (70, 0.00000055555)\r\n        INTO TEST_DIGITS (ID, X) VALUES (71, 3.3)\r\n        INTO TEST_DIGITS (ID, X) VALUES (72, 3.03)\r\n        INTO TEST_DIGITS (ID, X) VALUES (73, 3.003)\r\n        INTO TEST_DIGITS (ID, X) VALUES (74, 3.0003)\r\n        INTO TEST_DIGITS (ID, X) VALUES (75, 3.00003)\r\n        INTO TEST_DIGITS (ID, X) VALUES (76, 30.3)\r\n        INTO TEST_DIGITS (ID, X) VALUES (77, 30.03)\r\n        INTO TEST_DIGITS (ID, X) VALUES (78, 30.003)\r\n        INTO TEST_DIGITS (ID, X) VALUES (79, 30.0003)\r\n        INTO TEST_DIGITS (ID, X) VALUES (80, 30.00003)\r\n        INTO TEST_DIGITS (ID, X) VALUES (81, 300.3)\r\n        INTO TEST_DIGITS (ID, X) VALUES (82, 300.03)\r\n        INTO TEST_DIGITS (ID, X) VALUES (83, 300.003)\r\n        INTO TEST_DIGITS (ID, X) VALUES (84, 300.0003)\r\n        INTO TEST_DIGITS (ID, X) VALUES (85, 300.00003)\r\n        INTO TEST_DIGITS (ID, X) VALUES (86, 3000.3)\r\n        INTO TEST_DIGITS (ID, X) VALUES (87, 3000.03)\r\n        INTO TEST_DIGITS (ID, X) VALUES (88, 3000.003)\r\n        INTO TEST_DIGITS (ID, X) VALUES (89, 3000.0003)\r\n        INTO TEST_DIGITS (ID, X) VALUES (90, 3000.00003)\r\n        INTO TEST_DIGITS (ID, X) VALUES (91, 30000.3)\r\n        INTO TEST_DIGITS (ID, X) VALUES (92, 30000.03)\r\n        INTO TEST_DIGITS (ID, X) VALUES (93, 30000.003)\r\n        INTO TEST_DIGITS (ID, X) VALUES (94, 30000.0003)\r\n        INTO TEST_DIGITS (ID, X) VALUES (95, 30000.00003)\r\n        INTO TEST_DIGITS (ID, X) VALUES (96, -5)\r\n        INTO TEST_DIGITS (ID, X) VALUES (97, -50)\r\n        INTO TEST_DIGITS (ID, X) VALUES (98, -500)\r\n        INTO TEST_DIGITS (ID, X) VALUES (99, -5000)\r\n        INTO TEST_DIGITS (ID, X) VALUES (100, -50000)\r\n        INTO TEST_DIGITS (ID, X) VALUES (101, -500000)\r\n        INTO TEST_DIGITS (ID, X) VALUES (102, -5000000)\r\n        INTO TEST_DIGITS (ID, X) VALUES (103, -55)\r\n        INTO TEST_DIGITS (ID, X) VALUES (104, -550)\r\n        INTO TEST_DIGITS (ID, X) VALUES (105, -5500)\r\n        INTO TEST_DIGITS (ID, X) VALUES (106, -55000)\r\n        INTO TEST_DIGITS (ID, X) VALUES (107, -550000)\r\n        INTO TEST_DIGITS (ID, X) VALUES (108, -5500000)\r\n        INTO TEST_DIGITS (ID, X) VALUES (109, -55000000)\r\n        INTO TEST_DIGITS (ID, X) VALUES (110, -555)\r\n        INTO TEST_DIGITS (ID, X) VALUES (111, -5550)\r\n        INTO TEST_DIGITS (ID, X) VALUES (112, -55500)\r\n        INTO TEST_DIGITS (ID, X) VALUES (113, -555000)\r\n        INTO TEST_DIGITS (ID, X) VALUES (114, -5550000)\r\n        INTO TEST_DIGITS (ID, X) VALUES (115, -55500000)\r\n        INTO TEST_DIGITS (ID, X) VALUES (116, -555000000)\r\n        INTO TEST_DIGITS (ID, X) VALUES (117, -5555)\r\n        INTO TEST_DIGITS (ID, X) VALUES (118, -55550)\r\n        INTO TEST_DIGITS (ID, X) VALUES (119, -555500)\r\n        INTO TEST_DIGITS (ID, X) VALUES (120, -5555000)\r\n        INTO TEST_DIGITS (ID, X) VALUES (121, -55550000)\r\n        INTO TEST_DIGITS (ID, X) VALUES (122, -555500000)\r\n        INTO TEST_DIGITS (ID, X) VALUES (123, -5555000000)\r\n        INTO TEST_DIGITS (ID, X) VALUES (124, -55555)\r\n        INTO TEST_DIGITS (ID, X) VALUES (125, -555550)\r\n        INTO TEST_DIGITS (ID, X) VALUES (126, -5555500)\r\n        INTO TEST_DIGITS (ID, X) VALUES (127, -55555000)\r\n        INTO TEST_DIGITS (ID, X) VALUES (128, -555550000)\r\n        INTO TEST_DIGITS (ID, X) VALUES (129, -5555500000)\r\n        INTO TEST_DIGITS (ID, X) VALUES (130, -55555000000)\r\n        INTO TEST_DIGITS (ID, X) VALUES (131, -0.5)\r\n        INTO TEST_DIGITS (ID, X) VALUES (132, -0.05)\r\n        INTO TEST_DIGITS (ID, X) VALUES (133, -0.005)\r\n        INTO TEST_DIGITS (ID, X) VALUES (134, -0.0005)\r\n        INTO TEST_DIGITS (ID, X) VALUES (135, -0.00005)\r\n        INTO TEST_DIGITS (ID, X) VALUES (136, -0.000005)\r\n        INTO TEST_DIGITS (ID, X) VALUES (137, -0.0000005)\r\n        INTO TEST_DIGITS (ID, X) VALUES (138, -0.55)\r\n        INTO TEST_DIGITS (ID, X) VALUES (139, -0.055)\r\n        INTO TEST_DIGITS (ID, X) VALUES (140, -0.0055)\r\n        INTO TEST_DIGITS (ID, X) VALUES (141, -0.00055)\r\n        INTO TEST_DIGITS (ID, X) VALUES (142, -0.000055)\r\n        INTO TEST_DIGITS (ID, X) VALUES (143, -0.0000055)\r\n        INTO TEST_DIGITS (ID, X) VALUES (144, -0.00000055)\r\n        INTO TEST_DIGITS (ID, X) VALUES (145, -0.555)\r\n        INTO TEST_DIGITS (ID, X) VALUES (146, -0.0555)\r\n        INTO TEST_DIGITS (ID, X) VALUES (147, -0.00555)\r\n        INTO TEST_DIGITS (ID, X) VALUES (148, -0.000555)\r\n        INTO TEST_DIGITS (ID, X) VALUES (149, -0.0000555)\r\n        INTO TEST_DIGITS (ID, X) VALUES (150, -0.00000555)\r\n        INTO TEST_DIGITS (ID, X) VALUES (151, -0.000000555)\r\n        INTO TEST_DIGITS (ID, X) VALUES (152, -0.5555)\r\n        INTO TEST_DIGITS (ID, X) VALUES (153, -0.05555)\r\n        INTO TEST_DIGITS (ID, X) VALUES (154, -0.005555)\r\n        INTO TEST_DIGITS (ID, X) VALUES (155, -0.0005555)\r\n        INTO TEST_DIGITS (ID, X) VALUES (156, -0.00005555)\r\n        INTO TEST_DIGITS (ID, X) VALUES (157, -0.000005555)\r\n        INTO TEST_DIGITS (ID, X) VALUES (158, -0.0000005555)\r\n        INTO TEST_DIGITS (ID, X) VALUES (159, -0.55555)\r\n        INTO TEST_DIGITS (ID, X) VALUES (160, -0.055555)\r\n        INTO TEST_DIGITS (ID, X) VALUES (161, -0.0055555)\r\n        INTO TEST_DIGITS (ID, X) VALUES (162, -0.00055555)\r\n        INTO TEST_DIGITS (ID, X) VALUES (163, -0.000055555)\r\n        INTO TEST_DIGITS (ID, X) VALUES (164, -0.0000055555)\r\n        INTO TEST_DIGITS (ID, X) VALUES (165, -0.00000055555)\r\n        INTO TEST_DIGITS (ID, X) VALUES (166, -3.3)\r\n        INTO TEST_DIGITS (ID, X) VALUES (167, -3.03)\r\n        INTO TEST_DIGITS (ID, X) VALUES (168, -3.003)\r\n        INTO TEST_DIGITS (ID, X) VALUES (169, -3.0003)\r\n        INTO TEST_DIGITS (ID, X) VALUES (170, -3.00003)\r\n        INTO TEST_DIGITS (ID, X) VALUES (171, -30.3)\r\n        INTO TEST_DIGITS (ID, X) VALUES (172, -30.03)\r\n        INTO TEST_DIGITS (ID, X) VALUES (173, -30.003)\r\n        INTO TEST_DIGITS (ID, X) VALUES (174, -30.0003)\r\n        INTO TEST_DIGITS (ID, X) VALUES (175, -30.00003)\r\n        INTO TEST_DIGITS (ID, X) VALUES (176, -300.3)\r\n        INTO TEST_DIGITS (ID, X) VALUES (177, -300.03)\r\n        INTO TEST_DIGITS (ID, X) VALUES (178, -300.003)\r\n        INTO TEST_DIGITS (ID, X) VALUES (179, -300.0003)\r\n        INTO TEST_DIGITS (ID, X) VALUES (180, -300.00003)\r\n        INTO TEST_DIGITS (ID, X) VALUES (181, -3000.3)\r\n        INTO TEST_DIGITS (ID, X) VALUES (182, -3000.03)\r\n        INTO TEST_DIGITS (ID, X) VALUES (183, -3000.003)\r\n        INTO TEST_DIGITS (ID, X) VALUES (184, -3000.0003)\r\n        INTO TEST_DIGITS (ID, X) VALUES (185, -3000.00003)\r\n        INTO TEST_DIGITS (ID, X) VALUES (186, -30000.3)\r\n        INTO TEST_DIGITS (ID, X) VALUES (187, -30000.03)\r\n        INTO TEST_DIGITS (ID, X) VALUES (188, -30000.003)\r\n        INTO TEST_DIGITS (ID, X) VALUES (189, -30000.0003)\r\n        INTO TEST_DIGITS (ID, X) VALUES (190, -30000.00003)\r\n        INTO TEST_DIGITS (ID, X) VALUES (191, 0.009375)\r\nSELECT 1 FROM DUAL\r\n```\r\n\r\nTest code:\r\n\r\n```go\r\npackage main\r\n\r\nimport (\r\n\t\"database/sql\"\r\n\t\"fmt\"\r\n\t\"math\"\r\n\t\"strconv\"\r\n\t\"os\"\r\n\r\n\t_ \"gopkg.in/rana/ora.v3\"\r\n)\r\n\r\nconst eps = 0.00000000001\r\n\r\nfunc main() {\r\n\tdb, err := sql.Open(\"ora\", os.Args[1])\r\n\tpanik(err)\r\n\r\n\trows, err := db.Query(\"SELECT ID, X, TO_CHAR(X) FROM TEST_DIGITS ORDER BY ID ASC\")\r\n\tpanik(err)\r\n\r\n\tdefer rows.Close()\r\n\r\n\tfor rows.Next() {\r\n\t\tid := 0\r\n\t\tf := 0.0\r\n\t\ts := \"\"\r\n\t\tparsed := 0.0\r\n\r\n\t\tpanik(rows.Scan(&id, &f, &s))\r\n\r\n\t\tparsed, err := strconv.ParseFloat(s, 64)\r\n\t\tpanik(err)\r\n\r\n\t\tdiff := math.Abs(f - parsed)\r\n\r\n\t\tif diff >= eps {\r\n\t\t\tfmt.Printf(\"%d: %.12f vs '%s' (diff = %f)\\n\", id, f, s, diff)\r\n\t\t}\r\n\t}\r\n\r\n}\r\n\r\nfunc panik(err error) {\r\n\tif err != nil {\r\n\t\tpanic(err)\r\n\t}\r\n}\r\n```\r\n\r\nFirst command line argument should be the data source name for the database.\r\n\r\nBy the way, thank you for this very nice library and the hard work you've done.\r\n\r\nBest Regards,\r\nPetri Vesanen\r\nAlma Talent"}}
{"actor":{"display_login":"tgulacsi"}}