1.Procedure can return 0 or n values whereas functions can return a single value which is mandatory.
2.Procedure can have input and output parameter whereas functions can have only input type of parameters.
3.Procedure can be used for select command as well as for DML commands(Insert,Delete,Update) and DDL Commands (Create,Drop) while functions can be used for only select commands.
4.Functions can be called from Procedure while Procedure can not be called from Functions.
5.Exceptions can be handled by try-catch block in Procedure whereas try-catch block can not be used in functions.
6.We can go for transaction management in procedure whereas we can't go in function. 7.Functions are normally used for computations where as procedures are normally used for executing business logic.
8.Stored procedure returns always integer value by default zero. where as function return type could be scalar or table or table values
9.Stored procedure is precompiled execution plan where as functions are not.
10.A procedure may modify an object where a function can only return a value The RETURN statement immediately completes the execution of a subprogram and returns control to the caller.
11.You can call stored procedure directly from other programing language (like dot net) but Functions have to be used in Query's
12.We can write commit statements in procedures but can not write in Functions.
2.Procedure can have input and output parameter whereas functions can have only input type of parameters.
3.Procedure can be used for select command as well as for DML commands(Insert,Delete,Update) and DDL Commands (Create,Drop) while functions can be used for only select commands.
4.Functions can be called from Procedure while Procedure can not be called from Functions.
5.Exceptions can be handled by try-catch block in Procedure whereas try-catch block can not be used in functions.
6.We can go for transaction management in procedure whereas we can't go in function. 7.Functions are normally used for computations where as procedures are normally used for executing business logic.
8.Stored procedure returns always integer value by default zero. where as function return type could be scalar or table or table values
9.Stored procedure is precompiled execution plan where as functions are not.
10.A procedure may modify an object where a function can only return a value The RETURN statement immediately completes the execution of a subprogram and returns control to the caller.
11.You can call stored procedure directly from other programing language (like dot net) but Functions have to be used in Query's
12.We can write commit statements in procedures but can not write in Functions.
No comments:
Post a Comment