CHECK CONSTRAINT of string to contain only digits. (Oracle SQL) -
I have a column, called PROD_NUM, which contains 'number' which is messy with zero, for example 001004569 They are all nine characters.
I do not use a numerical type because the normal operation on the number does not consider these "numbers" (for example, PROD_NUM * 2 is not any meaning). And since they are all the same length, The column is defined as a CHAR (9)
table product (PROD_NUM CHAR (9) NOT NULL-ETC.)
I would like to stop PROD_NUM so that only nine digits can be done. Apart from '0' in addition to '0', there is no other letter than '0'.
< Code> REGEXP_LIKE (PROD_NUM, '^ [[: number:]] {9} $')
Comments
Post a Comment