sqlbeginner

Procedure - Technique 4

Create stored procedures

sql
CREATE OR REPLACE PROCEDURE apply_monthly_interest(rate NUMERIC)
LANGUAGE plpgsql
AS $$
BEGIN
  UPDATE accounts
  SET balance = balance * (1 + rate)
  WHERE account_type = 'savings';
END;
$$;

CALL apply_monthly_interest(0.01);

Use Cases

  • database operations
  • data management

Tags

Related Snippets

Similar patterns you can reuse in the same workflow.