CoolInterview.com - World's Largest Collection of Interview Questions & Answers, FAQs, queries, sample papers, exam papers, dumps, what, why, how, where, when questions OneStopTesting.com - Testing EBooks, Tutorials, Articles, Jobs, Training Institutes etc.
OneStopGate.com - Gate EBooks, Tutorials, Articles, FAQs, Jobs, Training Institutes etc.
OneStopMBA.com - MBA EBooks, Tutorials, Articles, FAQs, Jobs, Training Institutes etc.
OneStopIAS.com - IAS EBooks, Tutorials, Articles, FAQs, Jobs, Training Institutes etc.
OneStopSAP.com - SAP EBooks, Tutorials, Articles, FAQs, Jobs, Training Institutes etc.
OneStopGRE.com - of GRE EBooks, Tutorials, Articles, FAQs, Jobs, Training Institutes etc.

Sponsored Links

Interview Questions
Our Services



INTERVIEW QUESTIONS DATABASE SQL DETAILS
Question :

Difference between Stored Procedure and Trigger



Category SQL Interview Questions
Rating (3.2) By 67 users
Added on 8/12/2011
Views 5286
Rate it!


Answers:

Source: CoolInterview.com

Information related to Stored procedure you can see in USER_SOURCE,USER_OBJECTS(current user) tables.

Information related to triggers stored in USER_SOURCE,USER_TRIGGERS (current user) Tables.

Stored procedure can't be inactive but trigger can be Inactive.

Source: CoolInterview.com



Source: CoolInterview.com

we can call stored procedure explicitly.

but trigger is automatically invoked when the action defined in trigger is done.
ex:
create trigger <trig_Name> after Insert on <table>


this trigger invoked after we insert something on that table.


Source: CoolInterview.com



Posted by: sathyaajh

Contact sathyaajh Contact sathyaajh

Source: CoolInterview.com

Triggers are used to initiate a particular activity after fulfilling certain condition.It need to define and can be enable and disable according to need.
Source: CoolInterview.com



Posted by: Amit

Contact Amit Contact Amit

Source: CoolInterview.com

Triggers get invoked automatically when the event specified in it gets fulfilled, it can't return any value.So user have no control over it's invocation.Whereas stored procedure can be called as per application requirement and can get output parameters.
Source: CoolInterview.com



Posted by: nilambari

Contact nilambari Contact nilambari

Source: CoolInterview.com

stored procedure is a block of code contains sql statements.
stored procedure is a precompiled block of code,which need not be compiled for every time calling.

trigger is a user defined constraint it has to be called when situation araises.
Source: CoolInterview.com



Posted by: pushpa g

Contact pushpa g Contact pushpa g

Source: CoolInterview.com

Triggers once defined are called automatically, there can be no explicit invocation
Stored procedure has to be called explicitly, moreover procedures can return values, triggers can't
Source: CoolInterview.com



Posted by: mahendra

Contact mahendra Contact mahendra

Source: CoolInterview.com

Stored procedure used to perform operation. but trigger used to prevent operation.
Source: CoolInterview.com



Posted by: Roobesh

Contact Roobesh Contact Roobesh

Source: CoolInterview.com

1. trigger doesnot except argument
but store procedure does.
2. trigger cannot be local and store as a stand alone object in database.
but store procedure can be store in package.
3. Trigger execute implicitly whereas store procedure execute via
procedure call from another block.



Source: CoolInterview.com



Posted by: Nitin

Contact Nitin Contact Nitin

Source: CoolInterview.com

you will have to call stored procedure but trigger automatically called
Source: CoolInterview.com



Posted by: Shabbir Alam

Contact Shabbir Alam Contact Shabbir Alam

Source: CoolInterview.com

PROCEDURE-> means it will call the specified function,when we assumed it before.procedure is active.
TRIGGER-> trigger are active for after fulfilling the specified conditions.
Source: CoolInterview.com



Posted by: sandhya

Contact sandhya Contact sandhya

Source: CoolInterview.com

We can call stored procedure explicitly.but Trigger is invoked implicitly.

procedures are invoked by the user whereas triggers are invoked by the system.

procedure can be created with out a table but a trigger can't be created with out table.

procedures accept parameters where as triggers can't.

procedures return a value,triggers can't return any value.
Source: CoolInterview.com



Posted by: ajay

Contact ajay Contact ajay

Source: CoolInterview.com

commit,savepoint and rollback
are not allowed in triggers.
We can write commit,savepoint and rollback in procedures.
Source: CoolInterview.com



Posted by: Milind

Contact Milind Contact Milind

Source: CoolInterview.com

Triggers are used to initiate a particular activity after fulfilling certain condition.It need to define and can be enable and disable according to need.



Source: CoolInterview.com



Posted by: william

Contact william Contact william

Source: CoolInterview.com

commit,savepoint and rollback
are not allowed in triggers.
We can write commit,savepoint and rollback in procedures.

But we can add commit,rollback in trigger by adding next Line:
Autonomous Transaction

Source: CoolInterview.com



Posted by: Swapnil Bhosale

Contact Swapnil Bhosale Contact Swapnil Bhosale

Source: CoolInterview.com

Stored procedures are used to perform a task and should be invoked explicitly using exec.
Triggers are used to restrict invalid transactions and invokes(fires) implicitly when an dml manipulation happens
Source: CoolInterview.com



Posted by: kiran

Contact kiran Contact kiran

Source: CoolInterview.com

A Stored Procedure is set of pre-compiled sql statements which are stored in memory. These statements are executed by executing that procedure which display results based on arguments passed to that procedure.

A trigger is invoked automatically when any operation (insertion,deletion and updation) is performed on particular table.Triggers are used to record events performed on table.
Source: CoolInterview.com



Posted by: Rajiv

Contact Rajiv Contact Rajiv

If you have the better answer, then send it to us. We will display your answer after the approval.
Rules to Post Answers in CoolInterview.com:-
  • There should not be any Spelling Mistakes.
  • There should not be any Gramatical Errors.
  • Answers must not contain any bad words.
  • Answers should not be the repeat of same answer, already approved.
  • Answer should be complete in itself.
Name :*
Email Id :*
Answer :*
Verification Code Code Image - Please contact webmaster if you have problems seeing this image code Not readable? Load New Code
Process Verification Enter the above shown code: *
Inform me about updated answers to this question

Related Questions
View Answer
When using a count(disitnct) is it better to use a self-join or temp table to find redundant data, and provide an example?

View Answer
What is the advantage to use trigger in your PL?

View Answer
What the difference between UNION and UNIONALL?

View Answer
How to find second maximum value from a table?

View Answer
How to display duplicate rows in a table?

View Answer
What is joint?

View Answer
What is the difference between TRUNCATE and DELETE commands
View Answer
Which system table contains information on constraints on all the tables created?
View Answer
Which command displays the SQL command in the SQL buffer, and then executes it
View Answer
What does the following query do



View Answer
What will be the output of the following query

View Answer
TRUNCATE TABLE EMP;

DELETE FROM EMP;

Will the outputs of the above two commands differ


View Answer
What is the difference between Single row sub-Query and Scalar sub-Query

View Answer
How do I write a cron which will run a SQL query and mail the results to a group?

View Answer
Is there any query which is used to find the case sensitivity in each records in database through visual basic?

View Answer
I have a table with duplicate names in it. Write me a query which returns only duplicate rows with number of times they are repeated.

View Answer
How to copy sql table.

View Answer
Difference between Store Procedure and Trigger

View Answer
Cursor Syntax brief history

View Answer
Explain normalization with examples.

View Answer

Please Note: We keep on updating better answers to this site. In case you are looking for Jobs, Pls Click Here Vyoms.com - Best Freshers & Experienced Jobs Website.

View ALL SQL Interview Questions & Answers



User Options
India News Network

Latest 20 Questions
What is an execution plan? When would you use it?
What is BCP? When does it used?
What are the advantages of using Stored Procedures?
What is a Scheduled Jobs or What is a Scheduled Tasks?
What is NOT NULL Constraint?
What is CHECK Constraint?
What is FOREIGN KEY?
What is UNIQUE KEY constraint?
What is PRIMARY KEY?
What is the difference between a Local and a Global temporary table?
Name 3 ways to get an accurate count of the number of records in a table?
What is Log Shipping?
What is SQL Server Agent?
Which command using Query Analyzer will give you the version of SQL server and operating system?
What are the authentication modes in SQL Server? How can it be changed?
What is SQL Profiler?
What are the properties and different Types of Sub-Queries?
What is the difference between a HAVING CLAUSE and a WHERE CLAUSE?
When is the use of UPDATE_STATISTICS command?
What is difference between DELETE and TRUNCATE commands?



Fresher Jobs | Experienced Jobs | Government Jobs | Walkin Jobs | Company Profiles | Interview Questions | Placement Papers | Companies In India | Consultants In India | Colleges In India | Exams In India | Latest Results | Notifications In India | Call Centers In India | Training Institutes In India | Job Communities In India | Courses In India | Jobs by Keyskills | Jobs by Functional Areas

Testing Articles | Testing Books | Testing Certifications | Testing FAQs | Testing Downloads | Testing Interview Questions | Testing Jobs | Testing Training Institutes

Gate Articles | Gate Books | Gate Colleges | Gate Downloads | Gate Faqs | Gate Jobs | Gate News | Gate Sample Papers | Gate Training Institutes

MBA Articles | MBA Books | MBA Case Studies | MBA Business Schools | MBA Current Affairs | MBA Downloads | MBA Events | MBA Notifications | MBA FAQs | MBA Jobs
MBA Job Consultants | MBA News | MBA Results | MBA Courses | MBA Sample Papers | MBA Interview Questions | MBA Training Institutes

GRE Articles | GRE Books | GRE Colleges | GRE Downloads | GRE Events | GRE FAQs | GRE News | GRE Training Institutes | GRE Sample Papers

IAS Articles | IAS Books | IAS Current Affairs | IAS Downloads | IAS Events | IAS FAQs | IAS News | IAS Notifications | IAS UPSC Jobs | IAS Previous Question Papers
IAS Results | IAS Sample Papers | IAS Interview Questions | IAS Training Institutes | IAS Toppers Interview

SAP Articles | SAP Books | SAP Certifications | SAP Companies | SAP Study Materials | SAP Events | SAP FAQs | SAP Jobs | SAP Job Consultants
SAP Links | SAP News | SAP Sample Papers | SAP Interview Questions | SAP Training Institutes |




Copyright ©2003-2016 CoolInterview.com, All Rights Reserved.
Privacy Policy | Terms and Conditions



Cache = 0.005859 Seconds