Calling SQL functions and not allowing to throw error.

Moderator: NorbertKrupa

Post Reply
fane89
Newbie
Newbie
Posts: 9
Joined: Tue Jul 25, 2017 9:12 am

Calling SQL functions and not allowing to throw error.

Post by fane89 » Wed Mar 21, 2018 9:13 am

Hello,

when calling to_number() or to_timestamp() function and something goes wrong an exception is thrown.
Is there a possiblity to return null instead of throwing an error? Like safe casting via

Code: Select all

::!
I thought maybe to write custom functions and catch those errors, but it cannot be done via CREATE FUNCTION (SQL Functions).Could it be done via native functions in C? Create wrapping functions which call for example to_number() and if errors are throws to return null?

Or maybe another approach?

Post Reply

Return to “Vertica SQL Functions”