Subject Typeless parameters (was: Re: [Firebird-Architect] FB 2.0 Road Map)
Author paulruizendaal
> Internally, COALESCE etc can take any type of parameters.
>
> Would this be possible to do for Stored Functions and Stored
> Procedures. So one could create a function like:
>
> create function DitchNull(param_in) returns ...
> begin
> if TypeOf(param_in) = Varchar /* or something */
> then Result = coalesce(param_in, '');
> else if ... etc
> end

I am sure it would be possible, but I would recommend against it. I
believe that PSQL should stay a strongly typed language and would be
dissapointed to see it go the way of Perl or VB (just think of
the "variant" mess).

If you want the above, I would recommend that PSQL gets function
overloading (like Algol 68, C++, Java, PL/SQL, etc.)and that the
above DitchNull example would be coded as a set of overloaded
functions.

By the way, in your example the function also returns a "variant"
datatype, which would be hard to handle in the relational engine and
the message port system. For this reason too, overloading is easier.

Paul