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

What is cursor status?

761


How to set up sql*plus output format in oracle?

591


Name the operator which is used in the query for pattern matching?

503


Which nosql database is best?

509


How do you declare a user-defined exception?

524






Is crud a cuss word?

541


What is the difference between function and procedure in pl/sql?

531


What is full join in sql?

517


What is the primary use of normalization?

520


What does select top 1 do in sql?

534


What will you get by the cursor attribute sql%rowcount?

547


What is inner join in sql?

584


What are sql built in functions?

506


Does sql profiler affect performance?

550


What is a nested table in word?

529