CoolInterview.com - World's Largest Collection of Interview Questions
Interview Success Kit - 9,000 Interview Que. & Ans.
Covers 9,000+ Interview Questions asked in actual MNC Interviews - all with model answers.
Start Your Own website Now
Sponsored Links

Interview Questions
Our Services


INTERVIEW QUESTIONS DATABASE SQL DETAILS
Question :
Difference between Stored Procedure and Trigger


Category SQL Interview Questions
Rating (0.3) By 67 users
Added on 8/12/2006
Views 5251
Rate it!
Answers:

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.



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.



Posted by: sathyaajh    

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.



Posted by: Amit    

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.



Posted by: nilambari    

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.



Posted by: pushpa g    

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



Posted by: mahendra    

Contact mahendra Contact mahendra

Stored procedure used to perform operation. but trigger used to prevent operation.



Posted by: Roobesh    

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.




Posted by: Nitin    

Contact Nitin Contact Nitin

you will have to call stored procedure but trigger automatically called



Posted by: Shabbir Alam    

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.



Posted by: sandhya    

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.



Posted by: ajay    

Contact ajay Contact ajay

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



Posted by: Milind    

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.




Posted by: william    

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



Posted by: Swapnil Bhosale    

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



Posted by: kiran    

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.



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

    User Options
    Sponsored Links


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

    Download Yahoo Messenger | Placement Papers| FREE SMS | ASP .Net Tutorial | Web Hosting | Dedicated Servers | C Interview Questions & Answers

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


    Cache = 0 Seconds