假如 我有这4个数 123456.1332
23421.123
3256.12342
1234,4213
能通过什么方式来查询出 不符合number(4,4)标准的数据呢 查询出的结果应该是
123456,1332
23421.123
3256.12342
------解决思路----------------------
number(p,s) p表示一共有多少位有效数字(即小数点左边最多有p-s位有效数字),s表示小数点右边有s位有效数字
以 number(8,4) 为例
select t.num from
(
select '23456.1332' num from dual
union all
select '23421.123' num from dual
union all
select '3256.12342' num from dual
union all
select '1234.4213' num from dual
) t where length(t.num) > 9 or (length(substr(t.num,1,instr(t.num,'.')-1))>4 or length(substr(t.num,instr(t.num,'.')+1)) >4)
------解决思路----------------------
with tmp as
(select '23456.1332' num from dual
union all
select '23421.123' num from dual
union all
select '3256.12342' num from dual
union all
select '1234.4223' num from dual)
select t.* from tmp t where num!=to_char(num,'fm9999.9999')