Two 'anyelement' parameters : Code Block « Postgre SQL « PostgreSQL






Two 'anyelement' parameters

postgres=#
postgres=# CREATE FUNCTION make_array(anyelement, anyelement) RETURNS anyarray AS $$
postgres$#    SELECT ARRAY[$1, $2];
postgres$# $$ LANGUAGE SQL;
CREATE FUNCTION
postgres=#
postgres=# SELECT make_array(1, 2) AS intarray, make_array('a'::text, 'b') AS textarray;
        REATE
 intarray | textarray
----------+-----------
 {1,2}    | {a,b}
(1 row)

postgres=#
postgres=#
postgres=# drop function make_array(anyelement, anyelement);
DROP FUNCTION
postgres=#

           
       








Related examples in the same category

1.SQL Functions Returning Sets
2.Create a subblock