Skip to content

Instantly share code, notes, and snippets.

@vithalsamp
Created February 25, 2018 16:33
Show Gist options
  • Save vithalsamp/68b21bdcb8dce9051ae77b5ecc1da9f0 to your computer and use it in GitHub Desktop.
Save vithalsamp/68b21bdcb8dce9051ae77b5ecc1da9f0 to your computer and use it in GitHub Desktop.
create or replace function udf_sql_bignum (float, float)
returns float
stable
as $$
select case when $1 > $2 then $1
else $2
end
$$ language sql;
--You can just call UDF as if you are calling built-in functions:
training=# select udf_sql_bignum(10.3,100.2);
udf_sql_bignum
----------------
100.2
(1 row)
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment