Oracle: SQL query that returns rows with only numeric values

前端 未结 6 525
抹茶落季
抹茶落季 2020-12-12 17:21

I have a field (column in Oracle) called X that has values like \"a1b2c3\", \"abc\", \"1ab\", \"123\", \"156\"

how do I write an sql query that returns me only the X

6条回答
  •  醉酒成梦
    2020-12-12 17:58

    You can use following command -

    LENGTH(TRIM(TRANSLATE(string1, '+-.0123456789', '')))
    

    This will return NULL if your string1 is Numeric

    your query would be -

    select * from tablename 
    where LENGTH(TRIM(TRANSLATE(X, '+-.0123456789', ''))) is null
    

提交回复
热议问题