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 is the difference between nested table and varray?
What is varchar example?
What is difference between joins and union?
which tcp/ip port does sql server run on? : Sql dba
What do you mean by stored procedures? How do we use it?
what is index? : Sql dba
Describe sql comments?
How to use distinct and count in sql query? Explain
What are user defined functions?
What is secondary key?
name 3 ways to get an accurate count of the number of records in a table? : Sql dba
what is oracle database ? : Sql dba
What is auto increment?
What do you mean by query optimization?
What is the difference between cross join and natural join?