实验表:
create table tmp( id int, name nvarchar2(20), primary key(id));
实验数据:
insert into tmp(id,name) values(1,'an,dy'); insert into tmp(id,name) values(2,'a,n,d,y'); insert into tmp(id,name) values(3,'andy,'); insert into tmp(id,name) values(4,',Bill');
函数使用:
SQL> select regexp_count(name,',') as ct,name from tmp; CT NAME ---------- ---------------------------------------- 1 an,dy 3 a,n,d,y 1 andy, 1 ,Bill
核心:
select regexp_count(name,',') as ct,name from tmp;
--END--