SQL Datatype to use when inserting money

前端 未结 2 734
后悔当初
后悔当初 2021-01-05 06:15

I am using Oracle SQL database and I have to insert a monetary value(salary) as part of a row. For some strange reason the money command isnt working, is there any alternate

2条回答
  •  小鲜肉
    小鲜肉 (楼主)
    2021-01-05 06:36

    The "strange" reason is simple: There is no MONEY data type.

    The data type most appropriate for monetary values would be NUMBER (using an appropriate scale). Since it is a decimal floating-point type, it is better suited for monetary values than the binary floating-point types BINARY_FLOAT and BINARY_DOUBLE.

    Note, though, that you will still need to parse the input string £00,000.000 in your front end and send it as a numeric value to the back end.

提交回复
热议问题