Create a SQL function line_total(qty int, price numeric) RETURNS numeric that returns qty * price, then call line_total(3, 10) as total.
Create a SQL function line_total(qty int, price numeric) RETURNS numeric that returns qty * price, then call line_total(3, 10) as total.
Answer
CREATE FUNCTION line_total(qty int, price numeric) RETURNS numeric AS SELECT qty * price LANGUAGE sql; SELECT line_total(3, 10) AS total;