Home » SQL & PL/SQL » SQL & PL/SQL » Query to get whether a string contains 2 upper characters and numbers using regular_exp (Oracle 10g)
|
|
|
|
|
|
|
|
|
|
|
Re: Query to get whether a string contains 2 upper characters and numbers using regular_exp [message #587115 is a reply to message #587082] |
Wed, 12 June 2013 10:27   |
 |
Michel Cadot
Messages: 68761 Registered: March 2007 Location: Saint-Maur, France, https...
|
Senior Member Account Moderator |
|
|
SQL> With
2 data as (
3 select 'ADad12341' val from dual union all
4 select 'ad12df331' val from dual union all
5 select 'Adweweww1' val from dual union all
6 select 'asA12fg4f' val from dual union all
7 select 'AaadaQwse' val from dual union all
8 select '123erQq1A' val from dual
9 )
10 select val,
11 case
12 when regexp_like(val, '[A-Z].*[A-Z]') and regexp_like(val, '\d.*\d')
13 then 1
14 else 0
15 end res
16 from data
17 /
VAL RES
--------- ----------
ADad12341 1
ad12df331 0
Adweweww1 0
asA12fg4f 0
AaadaQwse 0
123erQq1A 1
6 rows selected.
Regards
Michel
[Updated on: Wed, 12 June 2013 10:28] Report message to a moderator
|
|
|
|
Goto Forum:
Current Time: Tue Jul 08 00:51:03 CDT 2025
|