Friday, 22 April 2016

Stored procedures vs. Stored functions


1. Return value
    Procedure may return none or more values.
    Function must always return one value either a scalar value or a table.

2. Parameters
    Procedure have input, output parameters.
    Functions have only input parameters.

3. Exception handling
    Exception can be handled in Procedure by try-catch block.
    try-catch block cannot be used in a function.

4. Transactions
    Transaction management possible in procedure but not in function.

5. Calling dependency
    Stored procedures are called independently by EXEC command.
    Functions are called from within SQL statement.

    Functions can be called from procedure.
    Procedures cannot be called from function.

No comments:

Post a Comment

Note: only a member of this blog may post a comment.