SQL CREATE PROCEDURE Keyword
The CREATE PROCEDURE command is used to create a stored procedure. A stored procedure is a prepared SQL block that you can save and reuse to perform a task repeatedly.
SQL CREATE PROCEDURE Syntax
CREATE PROCEDURE procedure_name AS sql_statement;
SQL CREATE PROCEDURE Example
This query creates a procedure named SelectAllPatients
to select all records from the Patients
table.
CREATE PROCEDURE SelectAllPatients AS SELECT * FROM Patients;
Note: This code does not work in TechKubo playground. SQLite (and therefore TechKubo) does not support stored procedures.
SQL EXEC Procedure Syntax
EXEC procedure_name;
SQL EXEC Procedure Example
This query executes the SelectAllPatients
procedure.
EXEC SelectAllPatients;
Note: This code does not work in TechKubo playground. SQLite does not support executing stored procedures using
EXEC
.