All Forums Extensibility
pranilrp 9 posts Joined 07/10
27 Mar 2011
UDF overloading issue

Hi,
I have to convert SQL server function isNumeric to teradata.
IsNumeric checks for the string in numeric format or not.( eg. sel isNumeric('123'); --ans:- 1. sel isNumeric('abc'); --ans :- 0)
isNumeric also accepts numeric value or column as its parameter(dont know why??) (eg. sel isNumeric(123); --ans:- 1)
now implementing it in teradata, a way possible is overload it with two inputs, 1st varchar datatype and 2nd integer datatype( and many other datatype like FLOAT).
and it is done.
but problem occurs when it comes to null handling.
eg. sel isNumeric(null); --cant fit best function for this.

Jim Chapman 449 posts Joined 09/04
28 Mar 2011

Quite so. The argument type is ambiguous. You can do something like this:

select isNumeric(cast(null as char));

pranilrp 9 posts Joined 07/10
28 Mar 2011

Thanks a lot.
so i have to edit the part where isNumeric is occuring :-)

You must sign in to leave a comment.