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

Sikker TO_NUMBER()

Fra Oracle Database 12c Release 2 du kan bruge TO_NUMBER med DEFAULT ... ON CONVERSION ERROR :

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

Eller CAST :

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

db<>fiddle-demo



  1. Hvorfor forpligter SQL*Plus ved exit?

  2. SQLite - Slip en database

  3. Oracle Dynamic Pivoting

  4. SQL ORDER BY klausul for begyndere