"景先生毕设|www.jxszl.com

oracle 去掉字段中包含的数字

2022-12-21 13:47编辑: www.jxszl.com景先生毕设
oracle 去掉字段中包含的数字

一、查询包含数字的数据
  select REGEXP_REPLACE(a.column1,'\d',''),a.*,rowid from tablename a where   where regexp_like(a.column1,'\d');

二、更新字段中的数字为空
update  tablename a
set a.column1 =REGEXP_REPLACE(a.column1,'\d','')
where   where regexp_like(a.column1,'\d');


regexp_like扩展:
字符簇:
[[:alpha:]] 任何字母。
[[:digit:]] 任何数字。
[[:alnum:]] 任何字母和数字。
[[:space:]] 任何白字符。
[[:upper:]] 任何大写字母。
[[:lower:]] 任何小写字母。
[[:punct:]] 任何标点符号。
[[:xdigit:]] 任何16进制的数字,相当于[0-9a-fA-F]。

–-regexp_like  例句
–-查询column1中以1开头60结束的记录并且长度是7位
select * from tablename where column1 like ‘1____60’;
select * from tablename where regexp_like(column1,‘1…60’);
–-查询column1中以1开头60结束的记录并且长度是7位并且全部是数字的记录。
–-使用like就不是很好实现了。
select * from tablename where regexp_like(column1,‘1[0-9]{4}60’);
–- 也可以这样实现,使用字符集。
select * from tablename where regexp_like(column1,‘1[[:digit:]]{4}60’);
–- 查询column1中不是纯数字的记录
select * from tablename where not regexp_like(column1,’1+KaTeX parse error: Double superscript at position 73: …_like(column1,'^[^̲[:digit:]]+’);
–-查询以12或者1b开头的记录.不区分大小写。
select * from tablename where regexp_like(column1,’^1[2b]’,‘i’);
–-查询以12或者1b开头的记录.区分大小写。
select * from tablename where regexp_like(column1,’^1[2B]’);
–- 查询数据中包含空白的记录。
select * from tablename where regexp_like(column1,’[[:space:]]’);
–-查询所有包含小写字母或者数字的记录。
select * from tablename where regexp_like(column1,’^([a-z]+|[0-9]+)$’);
–-查询任何包含标点符号的记录。
select * from tablename where regexp_like(column1,’[[:punct:]]’);
原文链接:http://www.jxszl.com/biancheng/shujuku/84596.html