Name
_cvt — internal CONVERT implementation with optional fallback value
Synopsis
any _cvt(
|
in template any, |
| in expression any, | |
in error_value any); |
Description
_cvt is the internal implementation behind SQL's
CONVERT expression. It converts
expression to the SQL data type implied by
template. If conversion fails and
error_value is supplied, that fallback is returned
instead of raising an error. Application code should normally use the
CONVERT SQL syntax rather than calling
_cvt directly.
Parameters
template
A value whose SQL type is the conversion target (for example a typed literal or NULL cast).
expression
The value to convert.
error_value
Fallback returned when conversion fails instead of signalling an error.
Return Types
The converted value as type implied by template,
or error_value on failure.