SQL Datatype to use when inserting money

前端 未结 2 761
后悔当初
后悔当初 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:27

    Look at this line

    salary MONEY NOT NULL
    

    There is no existing money datatype.

    If you are looking for something similar to SQL-Server small money type, you want to use a Number(10,4) and then format the number.

    You can format the number using to_char function

    select to_char(yourColumn, '$99,999.99') from yourTable where someCondition
    

提交回复
热议问题