Even if I have a function ( Instead of having multiple functions with polymorphic anyelement type) with required input parameters like below
decode(numeric,integer,text,text)
It's not functioning as expected and showing below error,
ERROR: function decode(numeric, integer, unknown, unknown) does not exist
LINE 1: select decode(lotid,1,'Lot Id Found','Lot Id not found') fro...
^
HINT: No function matches the given name and argument types. You might need to add explicit type casts.
********** Error **********
ERROR: function decode(numeric, integer, unknown, unknown) does not exist
SQL state: 42883
Hint: No function matches the given name and argument types. You might need to add explicit type casts.
Character: 8
Case #2 :
But when I try to run a select query like this
select decode(lotid::integer,1,'Lot Id Found','Lot Id not found') from public.test_decode; - Used external casting
it is working fine and showing result.
In this case I don't have a specific function like decode(integer,integer,text,text) ,I just have decode(anyelement,anyelement,text,text)
My question is how does this second case working without a specific function with required data types?
Thanks,