Search notes:

Oracle SQL: CAST

CAST(expr AS data-type) converts expr to a value of the indicated data type.
CAST(MULTISET (subquery) AS type-name) transforms the result set of the subquery to a collection type.
CAST(expr AS data-type DEFAULT val ON CONVERSION ERROR) evaluates to val if expr cannot be converted to data-type.
Compare the default … on conversion error clause with the validate_conversion function.
The indicated precision of the number (here: 4.1) is not respected when casting:
select
   cast('42.1'      as number(4,1) default -1 on conversion error) x,
   cast('foo'       as number(4,1) default -1 on conversion error) y,
   cast('12345.678' as number(4,1) default -1 on conversion error) z
from
   dual;
--
--          X          Y          Z
-- ---------- ---------- ----------
--       42.1         -1  12345.678

See also

The DEFAULT val ON CONVERSION ERROR clause can also be applied in the more specific conversion functions
ORA-22835: Buffer too small for CLOB to CHAR or BLOB to RAW conversion (actual: …, maximum: …)

Index

Fatal error: Uncaught PDOException: SQLSTATE[HY000]: General error: 8 attempt to write a readonly database in /home/httpd/vhosts/renenyffenegger.ch/php/web-request-database.php:78 Stack trace: #0 /home/httpd/vhosts/renenyffenegger.ch/php/web-request-database.php(78): PDOStatement->execute(Array) #1 /home/httpd/vhosts/renenyffenegger.ch/php/web-request-database.php(30): insert_webrequest_('/notes/developm...', 1758204033, '216.73.216.150', 'Mozilla/5.0 App...', NULL) #2 /home/httpd/vhosts/renenyffenegger.ch/httpsdocs/notes/development/databases/Oracle/SQL/functions/conversion/cast(63): insert_webrequest() #3 {main} thrown in /home/httpd/vhosts/renenyffenegger.ch/php/web-request-database.php on line 78