Check our online training feedbacks Here

22 December 2010

Functions vs Stored Procedure

  • UDF can be used in the SQL statements anywhere in the WHERE/HAVING/SELECT section where as Stored procedures cannot be.
  • UDFs that return tables can be treated as another rowset(which can be used in JOINs with other tables),but Procedures cant.
  • Procedure can return zero or n values whereas function can return one value which is mandatory.
  • Procedures can have input,output parameters for it whereas functions can have only input parameters.
  • Procedure allow select as well as DML statement in it whereas function allow only select statement in it.
  • Functions can be called from procedure whereas procedures cannot be called from function.
  • Exception can be handled by try-catch block in a procedure whereas try-catch block cannot be used in a function.
  • We can go for transaction management in procedure whereas we can't go in function.

No comments :

Post a Comment

Your comments, Feedbacks and Suggestions are very much valuable to me :)