CoolInterview.com - World's Largest Collection of Interview Questions & Answers, FAQs, queries, sample papers, exam papers, dumps, what, why, how, where, when questions
Our Services
Get 9,000 Interview Questions & Answers in an eBook.




Get it now !!
Send your Resume to 6000 Companies

Search Interview Questions

Question: Difference between Stored Procedure and Trigger

Answer: 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.



Category SQL Interview Questions & Answers - Exam Mode / Learning Mode
Rating (3.2) By 67 users
Added on 8/12/2011
Views 5313
Rate it!
Question: Difference between Stored Procedure and Trigger


Answer:

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


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

Answered by: sathyaajh | Date: | Contact sathyaajh Contact sathyaajh

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

Answered by: Amit | Date: | Contact Amit Contact Amit

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

Answered by: nilambari | Date: 2/18/2009 | Contact nilambari Contact nilambari

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

Answered by: pushpa g | Date: 5/30/2009 | Contact pushpa g Contact pushpa g

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

Answered by: mahendra | Date: 6/28/2009 | Contact mahendra Contact mahendra

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

Answered by: Roobesh | Date: 6/30/2009 | Contact Roobesh Contact Roobesh

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

Answered by: Nitin | Date: 8/18/2009 | Contact Nitin Contact Nitin

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

Answered by: Shabbir Alam | Date: 8/19/2009 | Contact Shabbir Alam Contact Shabbir Alam

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

Answered by: sandhya | Date: 9/7/2009 | Contact sandhya Contact sandhya

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

Answered by: ajay | Date: 11/28/2009 | Contact ajay Contact ajay

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

Answered by: Milind | Date: 12/11/2009 | Contact Milind Contact Milind

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

Answered by: william | Date: 4/19/2010 | Contact william Contact william

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

Answered by: Swapnil Bhosale | Date: 5/27/2010 | Contact Swapnil Bhosale Contact Swapnil Bhosale

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

Answered by: kiran | Date: 8/16/2010 | Contact kiran Contact kiran

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

Answered by: Rajiv | Date: 8/22/2010 | 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.

Post your answer here

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 - Exam Mode / Learning Mode




India News Network
Latest 20 Questions
An offer which is open for acceptance over a period of time is: (a) Cross Offer (b) Counter Offer (c) Standing Offer (d) Implied Offer
Specific offer can be communicated to__________ (a) All the parties of contract (b) General public in universe (c) Specific person (d) None of the above
_________ amounts to rejection of the original offer. (a) Cross offer (b) Special offer (c) Standing offer (d) Counter offer
A advertises to sell his old car by advertising in a newspaper. This offer is caleed: (a) General Offer (b) Special Offer (c) Continuing Offer (d) None of the above
In case a counter offer is made, the original offer stands: (a) Rejected (b) Accepted automatically (c) Accepted subject to certain modifications and variations (d) None of the above
In case of unenforceable contract having some technical defect, parties (a) Can sue upon it (b) Cannot sue upon it (c) Should consider it to be illegal (d) None of the above
If entire specified goods is perished before entering into contract of sale, the contract is (a) Valid (b) Void (c) Voidable (d) Cancelled
______________ contracts are also caled contracts with executed consideration. (a) Unilateral (b) Completed (c) Bilateral (d) Executory
A offers B to supply books @ Rs 100 each but B accepts the same with condition of 10% discount. This is a case of (a) Counter Offer (b) Cross Offer (c) Specific Offer (d) General Offer
_____________ is a game of chance. (a) Conditional Contract (b) Contingent Contract (c) Wagering Contract (d) Quasi Contract
There is no binding contract in case of _______ as one's offer cannot be constructed as acceptance (a) Cross Offer (b) Standing Offer (c) Counter Offer (d) Special Offer
An offer is made with an intention to have negotiation from other party. This type of offer is: (a) Invitation to offer (b) Valid offer (c) Voidable (d) None of the above
When an offer is made to the world at large, it is ____________ offer. (a) Counter (b) Special (c) General (d) None of the above
Implied contract even if not in writing or express words is perfectly _______________ if all the conditions are satisfied:- (a) Void (b) Voidable (c) Valid (d) Illegal
A specific offer can be accepted by ___________. (a) Any person (b) Any friend to offeror (c) The person to whom it is made (d) Any friend of offeree
An agreement toput a fire on a person's car is a ______: (a) Legal (b) Voidable (c) Valid (d) Illegal
"Holiday Packages" announced as an advertisement are an example of _________: (a) Offer (b) Counter Offer (c) Invitation to Offer (d) None of the above
A match fixing contract between a player and a broker is a: (a) Valid Contract (b) Unenforceable Contract (c) Void Contract (d) Illegal Contract
When a bookseller sells a book on cash payment then it is called as ___________: (a) Unilateral Contract (b) Bilateral Contract (c) Executed Contract (d) Executory Contract
____________ agreements are created by situation: (a) Written (b) Oral (c) Void (d) Implied
Cache = 0.015625 Seconds