On 24/07/2025 15:44, jian he wrote:
just want to confirm my understanding of ``[ FORMAT <cast template> ]``. SELECT CAST('2022-13-32' AS DATE FORMAT 'YYYY-MM-DD' DEFAULT NULL ON CONVERSION ERROR); will return NULL. because ``SELECT to_date('2022-13-32', 'YYYY-MM-DD');`` will error out, so the above query will fall back to the DEFAULT expression evaluation.
That is correct. Any error produced during typecasting will fall back to the DEFAULT value. If not supplied, the behavior is ERROR ON ERROR as it currently is.
Any error produced while converting the DEFAULT value to the requested type is raised as an error.
-- Vik Fearing