I am a little bit confused with which datatype I should use for Oracle's Number(*,0) with zero scale and any precision?
Which one should I use CF_SQL_INTEGER or CF_SQL_FLOAT? and why?
I am a little bit confused with which datatype I should use for Oracle's Number(*,0) with zero scale and any precision?
Which one should I use CF_SQL_INTEGER or CF_SQL_FLOAT? and why?
Copyright © 2021 Jogjafile Inc.
According to the documentation,
Number(*,0)means you are working with very large integers, ie up to 38 digits and no decimal places:That is too many digits to store in
CF_SQL_INTEGER. To support the full range, requires a type with a much greater capacity. Looking at the standard JDBC Mappings that means eitherjava.sql.Types.NUMERICorjava.sql.Types.DECIMAL. Both of those use java's BigDecimal for storage, which has more than enough capacity forNumber(38,0).The cfqueryparam matrix and Oracle JDBC driver documentation both say the same thing about the DECIMAL type. Since
java.sql.Types.NUMERICis really just a synonym forjava.sql.Types.DECIMALyou can use either one.Note: When using cfqueryparam, if you omit the "scale" attribute, it defaults to scale="0", ie no decimal places.