create elt() in postgresql
ELT() is inbuilt in mysql.it returns str1 if N = 1, str2 if N = 2, and so on. Returns NULL if N is less than 1 or greater than the number of arguments
syntax:ELT(N,str1,str2,str3,…)
User defined function in postgresql for ELT().
syntax:
CREATE OR REPLACE FUNCTION elt(integer, text, text)
RETURNS text AS $$
SELECT CASE
WHEN $1 2 THEN NULL
WHEN $1 = 1 THEN $2
ELSE $3
END
$$ IMMUTABLE LANGUAGE SQL;
