What's the difference between NUMERIC and DECIMAL


In Firebird, there is no difference.

In SQL Standard, NUMERIC is a more strict datatype which should enforce the declared precision, while DECIMAL can accept more numbers than declared. However, in Firebird, both types accept more numbers (i.e. they behave like DECIMAL).

There is misinformation in other online Firebird related documents regarding this, but it is rather easy to test:

create table testnum (
n1 numeric(5,2),
d1 decimal(5,2)
);

INSERT INTO TESTNUM (N1, D1)
VALUES ( 123456.12, 123456.12 );

As you can see, the INSERT statement is executed without errors and when you select you would get both values back as well.


Do you find this FAQ incorrect or incomplete? Please e-mail us what needs to be changed. To ensure quality, each change is checked by our editors (and often tested on live Firebird databases), before it enters the main FAQ database. If you desire so, the changes will be credited to your name. To learn more, visit our add content page.



All contents are copyright © 2007-2024 FirebirdFAQ.org unless otherwise stated in the text.


Links   Firebird   News   FlameRobin   Powered by FB: Home Inventory   Euchre  
Add content   About  

Categories
 Newbies
 SQL
 Installation and setup
 Backup and restore
 Performance
 Security
 Connectivity and API
 HOWTOs
 Errors and error codes
 Miscellaneous