When working with variant and dynamic columns, it would be particularly useful to have a cast function that returned null, rather than an exception, when performing a cast.
Options:
1) Define a function, SAFECONVERT, similar to CONVERT but with the semantics that it returns null if the convert fails. Since this a function, like CONVERT it would be invoked with the function-escape:
{fn SAFECONVERT(variant_column,SQL_INTEGER)}
2) If we wanted a slightly simpler way to invoke the safe cast, we could define a safe_cast escape clause that returns null if the cast fails:
When working with variant and dynamic columns, it would be particularly useful to have a cast function that returned null, rather than an exception, when performing a cast.
Options: 1) Define a function, SAFECONVERT, similar to CONVERT but with the semantics that it returns null if the convert fails. Since this a function, like CONVERT it would be invoked with the function-escape:
2) If we wanted a slightly simpler way to invoke the safe cast, we could define a safe_cast escape clause that returns null if the cast fails:
ODBC-safe-cast-escape ::= ODBC-esc-initiator safe_cast ( value-exp, data-type ) ODBC-esc-terminator
This could be (slightly more simply) invoked as: