Author: James Nakasone Wong <janaka_tech@bluebottle.com>
----
=====================
CREATE FUNCTION somefunc() RETURNS integer AS '
DECLARE
quantity integer := 30;
BEGIN
RAISE NOTICE ''Quantity here is %'', quantity; -- Quantity here is 30
quantity := 50;
--
-- Create a subblock
--
DECLARE
quantity integer := 80;
BEGIN
RAISE NOTICE ''Quantity here is %'', quantity; -- Quantity here is 80
END;
RAISE NOTICE ''Quantity here is %'', quantity; -- Quantity here is 50
RETURN quantity;
END;
' LANGUAGE plpgsql;
==============================
I 've saved above text in f2.sql
then when I upload this file (f2.sql) an error appeared? can anybody advice what shall I need to do from there ?
============================
test=# \i f2.sql
psql:f2.sql:20: ERROR: language "plpgsql" does not exist
HINT: You need to use "createlang" to load the language into the database.
test=#
----
Manual page: http://wwwmaster.postgresql.org/docs/7.4/interactive/plpgsql.html
Reject: http://wwwmaster.postgresql.org/admin/comments.php?action=reject&id=1984
Edit: http://wwwmaster.postgresql.org/admin/comment-edit.php?id=1984
Delete: http://wwwmaster.postgresql.org/admin/comments.php?action=delete&id=1984