According to the Oracle documentation, a NUMBER(5,0) column could hold Int16 and partially Int32 values. I'm developing an application (using ODP.NET) without the Entity Framework (EF), and can't define custom mappings (edmMappings) in an App.Config file. ODP.NET doesn't support edmMappings in non-EF applications (at least they are ignored).
Tested edmMappings:
<add NETType="int16" MinPrecision="4" MaxPrecision="5" DBType="Number" /><add name="int16" precision="4" /> (note; next one is int32 which is using precision 9)<add name="int16" value="edmmapping number(4,0)" /> (note; next one is int32 which is using precision 9)
This is causing 'issues' in the application, because it expects the Int16 datatype when executing a select query, which contains the NUMBER(5,0) column.
At this moment, I can only think of the next (not prefered) solutions:
- Change the
NUMBER(5,0)column toNUMBER(4,0). - Cast the cell value (of the
NUMBER(5,0)) to anInt32(instead of the expectedInt16type).
Is it somehow possible to (always) map a NUMBER(5,0) column to an Int16 (.NET type)?
(Perhaps I'm not aware of a certain setting and/or field of the OracleConnection, OracleDataAdapter or OracleDataReader class).