还有啊,比如:SELECT to_char(inmoneyid.nextval,'') FROM dual显示一个#, SELECT to_char(inmoneyid.nextval,'00') FROM dual显示两个#..... 只要0的个数,不够inmoneyid.nextval实际值的长度,全是#!
SELECT length(to_char(inmoneyid.NEXTVAL)) FROM dual显示出来是正确的长度!
官方解释: FM "Fill mode". This modifier suppresses blank padding in the return value of the TO_CHAR function:In a datetime format element of a TO_CHAR function, this modifier suppresses blanks in subsequent character elements (such as MONTH) and suppresses leading zeroes for subsequent number elements (such as MI) in a date format model. Without FM, the result of a character element is always right padded with blanks to a fixed length, and leading zeroes are always returned for a number element. With FM, because there is no blank padding, the length of the return value may vary. In a number format element of a TO_CHAR function, this modifier suppresses blanks added to the left of the number, so that the result is left-justified in the output buffer. Without FM, the result is always right-justified in the buffer, resulting in blank-padding to the left of the number.
SELECT to_char(inmoneyid.nextval,'00') FROM dual显示两个#.....
只要0的个数,不够inmoneyid.nextval实际值的长度,全是#!
select to_char(inmoneyid.nextval,'fm000000');
FM
"Fill mode". This modifier suppresses blank padding in the return value of the TO_CHAR function:In a datetime format element of a TO_CHAR function, this modifier suppresses blanks in subsequent character elements (such as MONTH) and suppresses leading zeroes for subsequent number elements (such as MI) in a date format model. Without FM, the result of a character element is always right padded with blanks to a fixed length, and leading zeroes are always returned for a number element. With FM, because there is no blank padding, the length of the return value may vary.
In a number format element of a TO_CHAR function, this modifier suppresses blanks added to the left of the number, so that the result is left-justified in the output buffer. Without FM, the result is always right-justified in the buffer, resulting in blank-padding to the left of the number.