“Specified cast is not valid” when populating DataTable from OracleDataAdapter.Fill()

后端 未结 3 824
生来不讨喜
生来不讨喜 2021-02-02 11:36

I can\'t seem to find this question anywhere on Google (or StackOverflow), which really surprised me, so I\'m putting it on here to help others in the same situation.

I

3条回答
  •  忘了有多久
    2021-02-02 11:50

    I know this has been answered already, but I also found another alternative that I use as well. I used a CAST on the field that was giving me troubles.

    Based on OP's SELECT command:

    SELECT acct_no, CAST((market_value/mv_total) AS DECIMAL(14,4))  -- CAST to decimal here
    FROM myTable
    WHERE NVL(market_value, 0) != 0
    AND NVL(mv_total, 0) != 0
    

提交回复
热议问题