Dapper Oracle Number(10,0) is returned as Decimal Parser error

Go To StackoverFlow.com

2

I have a POCO:

public class Role
{
   public Int32 Id { get; set; }
   public string Name { set; get; }
}

The Oracle table is Id NUMBER(10,0) and Name VARCHAR2(100 CHAR)

Dapper inserts fine but when I read the records it bring the Id as decimal and I get a parser error. And NO, I can't change the Int32 Id to decimal Id in POCO class.

2012-04-03 19:42
by Shuaib
Can you change the Oracle Id NUMBER(10,0) to INTEGER? or change the query to something like SELECT CAST(Id AS INTEGER) FROM ...SwDevMan81 2012-04-03 19:56
Looks like NUMBER(10,0) is an Int64 Discussed here. Converting it back is probably causing the decimal conversion - SwDevMan81 2012-04-03 20:02
I tired and still returns as decimal. "SELECT CAST(ID AS INTEGER) as \"ID\", NAME, DESCRIPTION,ORDINAL FROM" - Shuaib 2012-04-03 20:12
If you change it to NUMBER(9,0) does that work - SwDevMan81 2012-04-03 20:13
Yes, I still get "Error parsing column 0 (ID=63 - Decimal) - Shuaib 2012-04-03 20:18
If you are using ODP.NET as Oracle DB Provider, Number(9,0) should map to int32 - Alex 2012-04-04 06:45


0

Thanks to Alex I installed ODP.net and it worked.

2012-04-05 17:35
by Shuaib