Primitive 10 / Stored procedure card

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.

Production answer

Stored procedure card is a reusable Oak Flats Muffler Men UI primitive with documented states, accessibility expectations, theme behavior, and implementation evidence.

Primary CTAReview Stored procedure card states
Generative search brief

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.

Live primitive — Mufflermen procedures
Stored procedurefn_quote_total(p_quote_id bigint, p_include_gst boolean) → integer
plpgsql2 args22 lines
PLPGSQLfn_quote_total()
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 procedurefn_audit_log() → trigger
plpgsql0 args10 lines
PLPGSQLfn_audit_log()
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;$$;