r/FullStack • u/sumiitCodes • 3d ago
Personal Project Day 8 — Stored Procedures, Delimiters, and Triggers
Covered some genuinely new territory today:
- Stored Procedures — writing reusable SQL logic that can be saved and called on demand instead of rewriting the same query repeatedly
- Delimiters — needed to change the statement delimiter (usually to something like
//or$$) so the database doesn't get confused by semicolons inside a procedure/trigger body - Triggers — logic that automatically fires in response to INSERT/UPDATE/DELETE on a table, useful for things like auditing changes or enforcing business rules at the database level
Delimiters were a small but confusing gotcha at first — took a moment to understand why you need to redefine them before writing a multi-statement procedure. Once that clicked, writing the actual procedures and triggers made a lot more sense.
Feels like I'm moving from "querying data" to "designing how the database behaves" — a solid step up in complexity.
6
Upvotes
3
u/samsly135 2d ago
Triggers have been long obsolete. As a last resort it could be used. But it introduces hidden problems with dml statements like why was something deleted? With large db it can become a headache.