How can I determine if a string is numeric in SQL?
问题 In a SQL query on Oracle 10g, I need to determine whether a string is numeric or not. How can I do this? 回答1: You can use REGEXP_LIKE: SELECT 1 FROM DUAL WHERE REGEXP_LIKE('23.9', '^\d+(\.\d+)?$', '') 回答2: You ca try this: SELECT LENGTH(TRIM(TRANSLATE(string1, ' +-.0123456789', ' '))) FROM DUAL where string1 is what you're evaluating. It will return null if numeric. Look here for further clarification 回答3: I don't have access to a 10G instance for testing, but this works in 9i: CREATE OR