CREATE OR REPLACE FUNCTION fn_quote_total( p_quote_id bigint, p_include_gst boolean DEFAULT true) RETURNS integerLANGUAGE plpgsqlAS $$DECLARE v_subtotal integer; v_gst integer;BEGIN SELECT subtotal_cents, gst_cents INTO v_subtotal, v_gst FROM quotes WHERE id = p_quote_id; IF p_include_gst THEN RETURN COALESCE(v_subtotal, 0) + COALESCE(v_gst, 0); END IF; RETURN COALESCE(v_subtotal, 0);END;$$;Stored procedure card
A stored procedure surface. The signature line shows the name, argument list, and return type with each element coloured (name amber, types teal, return type green). A row of meta chips carries the language, arg count, and line count. The body is rendered through the existing code-block primitive.
Stored procedure card is a reusable Oak Flats Muffler Men UI primitive with documented states, accessibility expectations, theme behavior, and implementation evidence.
Stored procedure card: A stored procedure surface. The signature line shows the name, argument list, and return type with each element coloured (name amber, types teal, return type green). A row of meta chips carries the language, arg count, and line count. The body is rendered through the existing code-block primitive.
CREATE OR REPLACE FUNCTION fn_audit_log()RETURNS triggerLANGUAGE plpgsqlAS $$BEGIN INSERT INTO audit_log (table_name, action, row_id, changed_at) VALUES (TG_TABLE_NAME, TG_OP, NEW.id, now()); RETURN NEW;END;$$;