Oracle SQL - REGEXP_LIKE contains characters other than a-z or A-Z

前端 未结 4 1404
耶瑟儿~
耶瑟儿~ 2020-12-14 08:06

I would like to create a query where I select all records which contain characters that are not a-z or A-Z

so something like this

SELECT * FROM mytable

4条回答
  •  星月不相逢
    2020-12-14 08:38

    Something like

    select *
      from foo
     where regexp_like( col1, '[^[:alpha:]]' ) ;
    

    should work

    SQL> create table foo( col1 varchar2(100) );
    
    Table created.
    
    SQL> insert into foo values( 'abc' );
    
    1 row created.
    
    SQL> insert into foo values( 'abc123' );
    
    1 row created.
    
    SQL> insert into foo values( 'def' );
    
    1 row created.
    
    SQL> select *
      2    from foo
      3   where regexp_like( col1, '[^[:alpha:]]' ) ;
    
    COL1
    --------------------------------------------------------------------------------
    abc123
    

提交回复
热议问题