---
title: "List the Major Difference between function and Stored Procedure?"  
description: "List the Major Difference between function and Stored Procedure?"  
author: "Manish Kumar"  
published: 2017-11-02  
updated: 2020-09-22  
canonical: https://www.mindstick.com/interview/23306/list-the-major-difference-between-function-and-stored-procedure  
category: "mssql server"  
tags: ["database", "mysql", "sql server", "sql"]  
reading_time: 2 minutes  

---

# List the Major Difference between function and Stored Procedure?

##### There are many differences between function and stored procedure some of them are-

- In function it is necessary to return a value but in Stored Procedure it is optional (Procedure can return zero or n values).
- Functions can have only input parameters for it but Procedures can have input/output parameters.
- We can call Functions from procedure but Procedures cannot be called from Function.
- Procedure gives the facility to select as well as DML (INSERT/UPDATE/DELETE) statement in it but in Function allows only SELECT statement in it.
- Procedures cannot be utilized in a SELECT statement whereas Function can be embedded in a SELECT statement.
- Stored Procedures cannot be used in the SQL statements anywhere in the WHERE/HAVING/SELECT section whereas Function can be.
-
- We can use try catch in procedure but try-catch cannot be used in function.

## Answers

### Answer by Manish Kumar

##### There are many differences between function and stored procedure some of them are-

- In function it is necessary to return a value but in Stored Procedure it is optional (Procedure can return zero or n values).
- Functions can have only input parameters for it but Procedures can have input/output parameters.
- We can call Functions from procedure but Procedures cannot be called from Function.
- Procedure gives the facility to select as well as DML (INSERT/UPDATE/DELETE) statement in it but in Function allows only SELECT statement in it.
- Procedures cannot be utilized in a SELECT statement whereas Function can be embedded in a SELECT statement.
- Stored Procedures cannot be used in the SQL statements anywhere in the WHERE/HAVING/SELECT section whereas Function can be.
-
- We can use try catch in procedure but try-catch cannot be used in function.


---

Original Source: https://www.mindstick.com/interview/23306/list-the-major-difference-between-function-and-stored-procedure

Copyright © MindStick Software Pvt. Ltd. This Markdown version is provided for developers, AI systems, and offline reading.
