What is difference between triggers and stored procedures.
And advantages of SP over triggers ?

Answer Posted / jaya

1) Stored procedures can accept parameters and can return values. Triggers can neither accept parameters nor return values.

2) A Trigger is dependent on a table and the application has no control to not fire a trigger when not needed. On the other hand, a stored procedure can be called as needed.

3) Procedure runs only when one call them manually whereas a trigger runs when there is any activity(insert,update,delete) on table on which the trigger is written.
4) Firing of a stored procedure can be controlled whereas on the other hand trigger will get fired whenever any modification takes place on the table.

Is This Answer Correct ?    4 Yes 1 No



Post New Answer       View All Answers


Please Help Members By Posting Answers For Below Questions

When to use inner join and left join?

529


What is relationship? How many types of relationship are there?

592


What is range partitioning?

522


What is column?

553


What is data control language?

532






What is the use of double ampersand (&&) in sql queries? Give an example

613


How many row comparison operators are used while working with a subquery?

538


What is materialized view. What are different methods of refresh?

784


How is a process of pl/sql compiled?

602


how to convert numeric values to character strings? : Sql dba

570


What is record type in pl sql?

550


What are the set operators in sql?

560


What is a recursive join sql?

597


What is the use of function in sql?

541


what is a database lock ? : Sql dba

594