Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • SEARCH
  • Home
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 3758020
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 19, 20262026-05-19T10:05:50+00:00 2026-05-19T10:05:50+00:00

create table test_tables ( id number(38) primary key, name varchar2(50), age number(5), gender varchar2(10),

  • 0
create table test_tables (
id number(38) primary key,
name varchar2(50),
age number(5),
gender varchar2(10),
point number(5,2)
);
insert into test_tables values (1,'name1',20,'male',80.5);
insert into test_tables values (2,'name2',21,'female',60.5);
insert into test_tables values (3,'name3',23,'male',90.5);
insert into test_tables values (4,'name4',19,'male',79.5);
insert into test_tables values (5,'name5',18,'female',80.5);

The result of TestTable.sum(:point) is 391,
why not 391.5?
I check rdoc,there are some description:

The value is returned with the same data type of the column

But in my case,the type of ‘point’ is number(5,2).
It’s not a float?

  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-05-19T10:05:51+00:00Added an answer on May 19, 2026 at 10:05 am

    I’m not especially familiar with SQLite but I think you should be using a DECIMAL type in your create table statement. More details:

    Active Record SQLite Type Mapping
    SQLite Types

    Be careful of this issue though. It seems that the sqlite3 ruby driver insists on creating Float ruby objects rather than BigDecimal for DECIMAL query results.

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

CREATE TABLE test (id NUMBER PRIMARY KEY, name VARCHAR2(30)); CREATE SEQUENCE test1_sequence START WITH
1 Create table like this CREATE TABLE oracle_connet_by_test ( item_id NUMBER PRIMARY KEY, parent_id
I have the following table: CREATE TABLE TEST(ID TINYINT NULL, COL1 CHAR(1)) INSERT INTO
I have the following test-code: CREATE TABLE #Foo (Foo int) INSERT INTO #Foo SELECT
I have an Insert statement to a table which has a primary key of
I work with Oracle 11g. I have one table: create table test (one number(2),
I have a table that's created like this: CREATE TABLE bin_test (id INTEGER PRIMARY
(Using Oracle) I have a table with key/value pairs like this: create table MESSAGE_INDEX
I have this table with which I create dynamic checkboxes (the number of records
I have a table defined as this: CREATE TABLE A_TEST ( ID NUMBER NOT

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.