Trabla: FUNCTION template with input params and SINGLE return value
Solving:
-- Basic template for plsql function with input params and SINGLE return value
CREATE OR REPLACE FUNCTION myfunction ( param1 numeric, param2 character varying )
RETURNS character varying AS
$BODY$
DECLARE
-- Variables
var1 int;
var2 int;
BEGIN
-- Function body
-- Put your code or sql statements here
RETURN 'this is function result';
END;
$BODY$
LANGUAGE plpgsql VOLATILE
COST 100;
-- Set function owner
ALTER FUNCTION myfunction (numeric, character varying)
OWNER TO postgre;
Example call of function:
SELECT myfunction(1,'bla');
No comments:
Post a Comment