check once
Nitesh, July 27, 2016 - 10:15 am UTC
Sir,
My table contains "name" column in which entries are like :
Nitesh
Ajay
Tom
Thatharao
IZmandanish
vallamalareddy
etc
now i Want the the name of person who are having exactly two times the occurance of letter 'a'.i.e. izmandanish.
July 27, 2016 - 5:21 pm UTC
As the review below says, just replace the with clause with you table name!
Thats what they gave you, just not with a table.
paul, July 27, 2016 - 1:55 pm UTC
Maybe this is more clear?
drop table t;
create table t (name varchar2(60));
insert into t values ('Nitesh');
insert into t values ('Ajay');
insert into t values ('Tom');
insert into t values ('Thatharao');
insert into t values ('IZmandanish');
insert into t values ('vallamalareddy');
//looks for 'a' ONLY
select name from t
where length(name) - length(replace(name, 'a')) = 2;
//looks for 'a' ONLY
select name from t
where regexp_count(name, 'a') = 2;
//Loos for 'a' and 'A' (case insensitive)
select name from t
where regexp_count(name, 'a',1,'i') = 2;
July 27, 2016 - 5:22 pm UTC
Thanks for clarifying