detect numbers from columns
808874Oct 28 2010 — edited Nov 2 2010Hi all,
i would like to ask a question.
my situation is like this
i have columns A, B, C and D. And then, my question is how to detect a 5 digit from 4 of A, B, C, D columns.
example is like this
insert into XYZ
(A,B,C,D)
values
(
'4780No 2 SS2/59',
'33333abc',
'111111abc',
'abc'
)
below this is a step i detect digits from a column
select COUNT(*) from XYZ WHERE REGEXP_LIKE (column name, '\d{5}');
for this example,
i found out that columns that contain 5 digits and above will return 1 for me.
'33333abc' = 5digits will return 1 for me.
and
'111111abc' = 6digits will return 1 for me.
i wan exactly 5digits only will return me 1,other is return 0
can anyone know where i had make a mistake and can make a changes on my logic.
or
have other better solution or idea to detect 5 digits from a columns.
thank you everybody
thank a lot.