Loading Page Content...
Preparing courses, live labs, and learning resources.सामग्री लोड हो रही है, कृपया प्रतीक्षा करें...
Preparing courses, live labs, and learning resources.सामग्री लोड हो रही है, कृपया प्रतीक्षा करें...
A Stored Procedure is a compiled collection of one or more SQL statements and procedural logic stored directly in the database catalog. Instead of sending lengthy SQL text from client applications over the network, the client simply invokes the procedure by name using the CALL statement.
Stored procedures reduce network overhead, centralize business logic, and enforce strict security boundaries.
In standard SQL execution, the semicolon (;) tells MySQL to execute the preceding statement immediately. However, stored procedure bodies contain internal statements that also terminate with semicolons.
To prevent the MySQL CLI from executing prematurely when encountering the first internal semicolon, you must temporarily change the statement delimiter using the DELIMITER command:
Let's construct a procedure to generate a quarterly sales summary:
Continue learning with hands-on practice, examples, and exercises in the upcoming topic.
| Previous Lesson | Next Lesson |
|---|---|
| SQL Query Anti-Patterns & Best Practices | Procedure Parameters: IN, OUT, and INOUT |
Test your understanding of this lesson with 5 questions. Each question has one correct answer.