oracle - Filter option using regular expression -
i have requirement filter names in table.
example table name :- student
columns :- name, class.
the date
name ----class
highspeed ---c
highspeed11 ---c1
highspeed22 ---c2
normal-------------n
normal1-------------n1
normal2-------------n2
like have data srq, pwe ...
my requirement need remove data using name...
select distinct name student upper (name) 'srp%' or upper (name) 'highspeed%' or upper (name) 'srq%' or upper (name) 'pwe%' or upper (name) 'spinterface%' or upper (name) 'srm%' instead of using or condition, please let me know other option... ?
thanks in advance.
i'm not oracle user, quick through docs indicates oracle supports posix extended regular expressions (ere). regular expression matches names in query be:
^(srp|highspeed|srq|pwe|spinterface|srm)
it looks oracle supplies regexp_like function, query re-written using regular expression as:
select distinct name student regexp_like(upper(name), '^(srp|highspeed|srq|pwe|spinterface|srm)');
i'm afraid don't have access oracle test that's regular expression like.
Comments
Post a Comment