PostgreSQL/Select Query/Expressions
Using expressions
postgres=# -- Using expressions
postgres=#
postgres=# CREATE FUNCTION a_function () RETURNS int4 AS "
postgres"# DECLARE
postgres"# an_integer int4;
postgres"# BEGIN
postgres"# an_integer := 10 * 10;
postgres"# return an_integer;
postgres"# END;
postgres"# " LANGUAGE "plpgsql";
CREATE FUNCTION
postgres=#
postgres=#
postgres=# SELECT a_function() AS output;
output
--------
100
(1 row)
postgres=#
postgres=# drop function a_function();
DROP FUNCTION
postgres=#
postgres=#