精度意味着您最多需要
allowed_precision数字中的数字(严格来说,不计算前导零,但我会忽略这一点)。刻度表示最多
allowed_scale可以在小数点后。
这建议使用正则表达式,例如:
[-]?[0-9]{1,<before>}[.]?[0-9]{0,<after>}您可以构造正则表达式:
NOT REGEXP_LIKE(COLUMN_NAME, REPLACE(REPLACE('[-]?[0-9]{1,<before>}[.]?[0-9]{0,<after>}', '<before>', allowed_precision - allowed_scale ), '<after>', allowed_scale)现在,变量正则表达式的效率非常低。您也可以使用
like和其他功能来执行逻辑。我认为条件是:
(column_name not like '%.%.%' and column_name not like '_%-%' and translate(column_name, '0123456789-.x', 'x') is null and length(translate(column_name, '-.x', 'x') <= allowed_precision and length(translate(column_name, '-.x', 'x') >= 1 and instr(translate(column_name, '-.x', 'x'), '.') <= allowed_precision - allowed_scale)



