Oracle
 sql >> Datenbank >  >> RDS >> Oracle

Safe TO_NUMBER()

Ab Oracle Database 12c Release 2 Sie könnten TO_NUMBER verwenden mit DEFAULT ... ON CONVERSION ERROR :

SELECT TO_NUMBER('*' DEFAULT 0 ON CONVERSION ERROR) AS "Value"
FROM DUAL;

Oder CAST :

SELECT CAST('*' AS NUMBER DEFAULT 0 ON CONVERSION ERROR) AS "Value"
FROM DUAL;

db<>Fiddle-Demo