通过SQL查询所有字段是否为数字:
select *
from SAMPLE_INFO_YPLIST s
where s.SAMPLE_BATCH_NO = 'PBMK210618-AK853-ZX01-0201'
and (trim(translate(s.OD260_230, '0123456789.', ' ')) is not null
or trim(translate(s.O28S_18S, '0123456789.', ' ')) is not null
or trim(translate(s.OD260_280, '0123456789.', ' ')) is not null
or trim(translate(s.VOLUME, '0123456789.', ' ')) is not null
or trim(translate(s.CONCENTRATION, '0123456789.', ' ')) is not null
or trim(translate(s.TOTAL_QUANTITY, '0123456789.', ' ')) is not null
or trim(translate(s.FRAGMENT_SIZE, '0123456789.', ' ')) is not null);
查询结果:

可根据实际情况调整,比如现在设置的是“0123456789. ”即字段中若有#号即会被查询出来。

本文介绍了一种使用SQL查询来检查数据库表中特定记录的多个字段是否包含非数字字符的方法。通过translate和trim函数组合,可以有效地筛选出含有非数字字符的数据。
974

被折叠的 条评论
为什么被折叠?



