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
What are system versioned tables?
What are sql commands?
what is self join and what is the requirement of self join? : Sql dba
How many clustered indexes can be created on a table?
Can we insert in view in sql?
What is a primary key example?
Why we use joins in sql?
What is a null value?
How can one get sql*loader to commit only at the end of the load file? : aql loader
Why is there a need for sqlcode and sqlerrm variables?
Can a composite key be null?
What are the possible values for the boolean data field?
How many developers work on postgresql?
What is the most common sql injection tool?
what is an index? : Sql dba