Golgappa.net | Golgappa.org | BagIndia.net | BodyIndia.Com | CabIndia.net | CarsBikes.net | CarsBikes.org | CashIndia.net | ConsumerIndia.net | CookingIndia.net | DataIndia.net | DealIndia.net | EmailIndia.net | FirstTablet.com | FirstTourist.com | ForsaleIndia.net | IndiaBody.Com | IndiaCab.net | IndiaCash.net | IndiaModel.net | KidForum.net | OfficeIndia.net | PaysIndia.com | RestaurantIndia.net | RestaurantsIndia.net | SaleForum.net | SellForum.net | SoldIndia.com | StarIndia.net | TomatoCab.com | TomatoCabs.com | TownIndia.com
Interested to Buy Any Domain ? << Click Here >> for more details...

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

Answer Posted / ravi singh

Procedures:
- A procedure is PL/SQL block which is used to process a value and need to execute explicitly.
- Procedure can be call when required and it don't have any dependency on any DML operations on any table.
- Procedure can be called from any area of the code.
- You can pass IN/OUT parameters to the procedure through which you can use the output of the procedures.

Triggers:
- Triggers are PL/SQL block which are based on the events and got executed on the happening of any DML event on the specific table.
- They cannot be called or you cannot stop them from execution.
- You can write commit in the triggers with the help of autonomous transaction only.
- You can refer the values of the table with whom the trigger is linked with the help of :new and :old variables.

Advantages and Disadvantages: They both are mentioned in the above two posted answers.
But one main advantage of triggers over procedures is if you want to perform any action on the DML event of any table you should use triggers as you dont need to make a seperate call for your code.
One main disadvantage of triggers you cannot stop them being executed if you want to do it you have to explicitly disable the trigger.

Is This Answer Correct ?    8 Yes 3 No



Post New Answer       View All Answers


Please Help Members By Posting Answers For Below Questions

what are the properties and different types of sub-queries? : Sql dba

1032


What is gpt format?

935


What is a field in a database?

1063


What is sql data?

988


What is the difference between truncate and drop statements?

1178


What are the sql versions?

939


what are the differences between get and post methods in form submitting. Give the case where we can use get and we can use post methods? : Sql dba

1127


What is t-sql? : Transact sql

982


What is trigger explain it?

1011


What is the plv (pl/vision) package offers?

1046


How to start the command-line sql*plus?

1048


Is left join faster than join?

1045


what is sub-query? : Transact sql

1096


Is sql harder than python?

1097


Can you have more than one trigger on a table?

998