how to store BigInteger values in oracle database

后端 未结 4 1304

I have connected Java program to Oracle database using JDBC. I want to store BigInteger values(512 bits) in the database. What should be the type of the column?

4条回答
  •  粉色の甜心
    2021-01-13 13:13

    Both BigInteger and BigDecimal extend java.lang.Number, however this does not mean that you can cast from BigInteger up to Number then down to BigDecimal.

    There is a constructor in BigDecimal that takes a BigInteger, so try:

    BigDecimal d = new BigDecimal(b);
    

提交回复
热议问题