问题
I was given Oracle code and I'm trying to figure out what it is doing. Specifically it's converting a number to a string and I don't understand it.
The code is:
TO_CHAR(QTY_DISPENSED,'0000000V000')
What does the V do?
Jeff
回答1:
It's a "Format Model" for converting numbers to strings: https://docs.oracle.com/cd/B19306_01/server.102/b14200/sql_elements004.htm
Returns a value multiplied by 10n (and if necessary, round it up), where n is the number of 9's after the V.
So basically it's taking your QTY_DISPENSED
multiplying it by 1000 and returning a string.
来源:https://stackoverflow.com/questions/51367212/oracle-to-char-function-v-in-format-string