The command to execute a stored procedure depends on your database: SQL Server uses EXEC, Oracle uses CALL or PL/SQL blocks, Snowflake uses CALL.
If you’re learning how to execute a stored procedure, the first thing to know is that the command is database-specific. SQL Server and Azure SQL rely on EXEC or EXECUTE, while Snowflake, MySQL, and others use CALL. This article covers the exact steps for the most common database systems, with working examples and the gotchas that catch beginners off guard.
How Do You Execute a Stored Procedure in SQL Server?
SQL Server offers two main ways to run a stored procedure — through the SQL Server Management Studio (SSMS) graphical interface or by running a T-SQL command in a query window. Both methods work for SQL Server and Azure SQL Database.
Using SSMS’s Execute Procedure Dialog
Open SSMS, connect to your instance, and expand Databases → Programmability → Stored Procedures. Right‑click the procedure you want to run and select Execute Stored Procedure.
In the Execute Procedure dialog, fill in each parameter under Value. If a parameter should be NULL, check Pass Null Value. Then click OK. The results window shows any output and row sets — that’s your cue the procedure ran successfully.
Running a Procedure with EXEC or EXECUTE
In a query window, the standard pattern is:
EXECUTE ProcedureName @param1 = 'value1', @param2 = 'value2';
You can also use the shorter EXEC keyword. Both are interchangeable. If the procedure has no parameters, just write EXEC ProcedureName;. After running the query, look at the Messages tab or results grid to confirm execution.
Microsoft’s official documentation for executing stored procedures covers parameter handling, output parameters, and return codes in detail.
Executing Stored Procedures in Other Database Systems
Outside of SQL Server, the syntax changes. Here are the most common alternatives.
Snowflake — Using CALL
Snowflake stored procedures are invoked with the CALL command:
CALL MyProcedure('input_value');
You need the USAGE privilege on the procedure and the database/schema where it lives. Snowflake’s documentation treats CALL as the only execution method.
Oracle — PL/SQL Block or CALL
Oracle gives you two options. The simplest is an anonymous PL/SQL block:
BEGIN
MyProcedure('input_value');
END;
Or you can use the SQL CALL statement:
CALL MyProcedure('input_value');
Both achieve the same result, but the BEGIN … END; block is more common in Oracle tooling.
MySQL and PostgreSQL
Both use CALL as the execution keyword, similar to Snowflake. For example:
CALL MyProcedure('input_value');
Parameter syntax may vary slightly — always check your database’s specific documentation.
Quick-Reference Table: Execution Keywords by Database
| Database | Keyword / Method | Example |
|---|---|---|
| SQL Server / Azure SQL (SSMS dialog) | Right‑click → Execute Stored Procedure | Fills parameters in dialog |
| SQL Server / Azure SQL (T‑SQL) | EXEC or EXECUTE |
EXEC GetUser @ID = 5; |
| Oracle (anonymous block) | BEGIN … END; |
BEGIN UpdateOrder(100); END; |
| Oracle (SQL command) | CALL |
CALL UpdateOrder(100); |
| Snowflake | CALL |
CALL CleanData('2024-01-01'); |
| MySQL | CALL |
CALL ArchiveOrders(90); |
| PostgreSQL | CALL |
CALL RefreshSummary(); |
Common Mistakes When Executing a Stored Procedure
Even experienced developers hit these snags. Here’s what to watch for.
| Error | Why It Happens | Fix |
|---|---|---|
| Wrong invocation keyword | Using EXEC on Snowflake or CALL on SQL Server |
Verify your DB’s command before running |
| Missing or mismatched parameters | Procedure expects values you didn’t supply; data types may not match | Check procedure definition (sp_help ProcedureName) for parameter list |
| Permission denied | User account lacks EXECUTE privilege |
Ask admin to grant EXECUTE ON [Procedure] TO [User] |
| Procedure not found | Wrong database or schema context | Use fully qualified name: EXEC db_name.schema.proc |
| Output parameters not captured | Running procedure without declaring output variables | Declare variables and pass them with the OUTPUT keyword |
| Assuming portability | Copying syntax from SQL Server to Oracle without converting | Rewrite invocation using the target DB’s rules |
Quick Checklist: How to Execute a Stored Procedure
Before you run any stored procedure, confirm these five points:
- Database type – SQL Server? Snowflake? Oracle? Pick the right keyword (
EXECvsCALL). - Procedure exists – Verify the name and location (database + schema).
- Parameters ready – Know the order, names, and data types of all required parameters.
- Permissions granted – Your user must have
EXECUTEon the procedure. - Success signal – After running, check for result sets, messages, or output parameters that confirm it finished.
References & Sources
- Microsoft Learn. “Execute a Stored Procedure – SQL Server” Covers SSMS dialog and T-SQL execution, parameter handling, and startup procedures.
- Snowflake Documentation. “Calling a Stored Procedure” Details the CALL command syntax and required privileges.
- Oracle Forums. “Executing a Stored Procedure” Community guidance on anonymous blocks and CALL statement.
