Interview Questions

1. What is the difference between Stored Procedure and Function?

  • Function must 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 whereas Procedures can have input/output parameters.
  • Functions can be called from Procedure whereas Procedures cannot be called from Function.
  • Procedure allows SELECT as well as DML(INSERT/UPDATE/DELETE) statement in it whereas 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.
  • Exception can be handled by try-catch block in a Procedure whereas try-catch block cannot be used in a Function.
By Hena Parveen 2 0
Is this helpful? Yes No

Submit an interview question

Submitted questions and answers are subject to review and editing, and may or may not be selected for posting, at the sole discretion of w3Sniff.

Get Started

Comments

Leave a Comment


Check out more interview questions

Based on your skills

MS SQL Server

2567754 1720 50 859

Angular

67722 92 0 46

Wordpress

57027 72 1 36