Oracle
 sql >> Database >  >> RDS >> Oracle

Query Oracle SQL per escludere righe contenenti caratteri non numerici

Puoi usare espressioni regolari. In questo caso, regexp_like( sales_id, '^[[:digit:]]*$' )

SQL> with x as (select 12345678 code, '456' sales_id from dual union all
  2             select 34534534, '678' from dual union all
  3             select 23423423, 'X123' from dual)
  4  select *
  5    from x
  6   where regexp_like( sales_id, '^[[:digit:]]*$' );

      CODE SALE
---------- ----
  12345678 456
  34534534 678