PostgreSQL: Documentation: 9.1: Declarations

PHOTO EMBED

Thu Aug 12 2021 16:51:06 GMT+0000 (Coordinated Universal Time)

Saved by @mvieira

CREATE FUNCTION sales_tax(real) RETURNS real AS $$
DECLARE
    subtotal ALIAS FOR $1;
BEGIN
    RETURN subtotal * 0.06;
END;
$$ LANGUAGE plpgsql;
content_copyCOPY

https://www.postgresql.org/docs/9.1/plpgsql-declarations.html