On Thu, 7 Nov 2002, Ludwig Lim wrote:
> Hi:
>
> Has anyone encountered this before?
> SELECT CAST ( (NULL*NULL) AS NUMERIC(2,0));
>
>
> returns the following error message:
> Cannot cast type '"char"' to '"numeric"'
It seems to me that it's trying to decide on a type
for the expression NULL * NULL. It's a NULL, but a
NULL of what type? I think the spec gets around
this by disallowing such structures AFAIK (NULL
can be used in like row value constructors, case
and cast). I think the "sql" way of doing the
above would be
select cast(cast(NULL as NUMERIC(2,0))*cast(NULL as NUMERIC(2,0))
as NUMERIC(2,0));