Variable Declarations : Declare Variable « Postgre SQL « PostgreSQL






Variable Declarations


postgres=# -- Variable Declarations
postgres=#
postgres=# CREATE FUNCTION identifier () RETURNS int4 AS '
postgres'#   DECLARE
postgres'#
postgres'#      -- Declare an integer.
postgres'#     subject_id INTEGER;
postgres'#
postgres'#      -- Declare a variable length character.
postgres'#     book_title VARCHAR(10);
postgres'#
postgres'#       -- Declare a floating point number.
postgres'#     book_price FLOAT;
postgres'#
postgres'#   BEGIN
postgres'#     return 10;
postgres'#   END;
postgres'# ' LANGUAGE 'plpgsql';
ERROR:  function "identifier" already exists with same argument types
postgres=#
postgres=# select identifier();
 identifier
------------
         10
(1 row)

postgres=#
postgres=# drop function identifier();
DROP FUNCTION
postgres=#
postgres=#
           
       








Related examples in the same category

1.Using variable declaration options