test datatype for ANY

Started by NosyManover 21 years ago1 messagesgeneral
Jump to latest
#1NosyMan
nosyman@gmail.com

Hi there,

How can I test the type of a parameter passed to a function via ANY data type?
I want something like this:

CREATE OR REPLACE FUNCTION myfunction(_param ANY) RETURNS INTEGER AS $$
BEGIN
IF "_param IS OF INTEGER TYPE" THEN
-- do something with INTEGER
END IF;
IF "param is of BOOLEAN TYPE" THEN
-- do something with BOOLEAN
END IF;
RETURN;
END;
$$ LANGUAGE plpgsql;

Thanks,
Nosy