Subject | How to CAST float to integer with error? |
---|---|
Author | |
Post date | 2015-05-25T10:04:09Z |
Hello,
is it possible by using CAST or in any other way to get database error when casting such number to integer?
SELECT CAST('13.245' AS INTEGER) FROM RDB$DATABASE
This gives 13 but instead I would like to get an error because precision is lost.
However, I would like to NOT get an error when doing this:
SELECT CAST('13.000' AS INTEGER) FROM RDB$DATABASE
Becasue here precision is not lost.
Is it possible to obtain such behaviour in easy way or do I have to use regular expressions?
Best regards.
is it possible by using CAST or in any other way to get database error when casting such number to integer?
SELECT CAST('13.245' AS INTEGER) FROM RDB$DATABASE
This gives 13 but instead I would like to get an error because precision is lost.
However, I would like to NOT get an error when doing this:
SELECT CAST('13.000' AS INTEGER) FROM RDB$DATABASE
Becasue here precision is not lost.
Is it possible to obtain such behaviour in easy way or do I have to use regular expressions?
Best regards.