I have a simple sqlite table created with:
private static final String TABLE_CREATE = "CREATE TABLE tab1("
+ "_id INTEGER PRIMARY KEY AUTOINCREMENT, "
+ "amount NUMERIC NOT NULL DEFAULT 0"
+ ");";
db.execSQL(TABLE_CREATE);
But when I insert values into the table they get rounded:
INSERT INTO tab1(amount) VALUES (123456789.12) // Becomes 1.23457e+08
INSERT INTO tab1(amount) VALUES (12345.67) // Becomes 12345.7
INSERT INTO tab1(amount) VALUES (300087.59) // Becomes 300088
INSERT INTO tab1(amount) VALUES (3000001.22) // Becomes 3e+06
How can I save the full number into the table and still be able to use queries like:
SELECT * FROM tab1 WHERE amount < 0
Edit:
@MikeT thanks for your sugestion, I was using the Cursor getString method. Now I'm using the getDouble method and then converting to BigDecimal and rounding, it solved the problem.