Home > Blockchain >  How to search for a name in where Oracle with string and number character
How to search for a name in where Oracle with string and number character

Time:08-16

I need to find records in Oracle that have only such record like 'string|number|number|number|number|number' for example - 'A12345'

select * from base where column_x like 'string|number|number|number|number|number'

CodePudding user response:

That's a letter followed by 5 digits:

SQL> with test (col) as
  2    (select 'A12345' from dual union all
  3     select 'B123CD' from dual union all
  4     select '123ABC' from dual
  5    )
  6  select *
  7  from test
  8  where regexp_like(col, '^[[:alpha:]]{1}[[:digit:]]{5}$');

COL
------
A12345

SQL>
  • Related