Skip to content

Instantly share code, notes, and snippets.

@larapollehn
Created November 30, 2020 19:53
Show Gist options
  • Select an option

  • Save larapollehn/8d26ef93db88f2aa23dc685298bc3e57 to your computer and use it in GitHub Desktop.

Select an option

Save larapollehn/8d26ef93db88f2aa23dc685298bc3e57 to your computer and use it in GitHub Desktop.
Simple exmple of a SQL Function for postgres. The function increments a given int by 1.
CREATE FUNCTION increment (age int)
RETURNS int
LANGUAGE plpgsql
AS $$
declare
incremented_age int;
BEGIN
incremented_age = age +1;
RETURN incremented_age;
END;
$$;
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment