Want to win a PS4? Go Premium and enter to win our High-Tech Treats giveaway. Enter to Win

x
?
Solved

trigger

Posted on 2016-07-28
5
Medium Priority
?
78 Views
Last Modified: 2016-07-28
what is the use of trigger in oracle database. where exactly it is used which occassions.
0
Comment
Question by:anishtv
[X]
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
5 Comments
 
LVL 77

Expert Comment

by:slightwv (䄆 Netminder)
ID: 41733437
What type of trigger?

There are system level and table level.  There are also "instead of" triggers for DML on views.

The online documentation is the best place to start:
http://docs.oracle.com/database/121/LNPLS/triggers.htm#LNPLS020
0
 
LVL 32

Expert Comment

by:awking00
ID: 41733439
Too many uses to enumerate. It's used wherever the occasion calls for it. Frequently it is used in conjunction with a sequence to generate an identity.
0
 
LVL 74

Accepted Solution

by:
sdstuber earned 2000 total points
ID: 41733474
triggers are, in my experience, used when users/applications have direct access to an object  but you want to maintain some level of consistent functionality.

For example - someone writes an insert statement to create a new row in a table.  You can use a trigger to ensure some columns are populated a certain way or others are not populated.  It can be as simple as forcing capitalization, or trimming white space.
or more sophisticated key generation/lookup or complicated calculations.

Similarly, if someone else writes an update or a delete, maybe you want to capture that action and write something else, or possibly block the action if the update or delete is invalid for some reason.


If you have a procedural api instead, that is, nobody can write sql directly against the object, but can only access it through procedures, then triggers are not necessary and are generally considered bad practice.
0
 
LVL 15

Expert Comment

by:Devinder Singh Virdi
ID: 41733488
Another important thing about trigger is that it slows down DML because for every DML Oracle has to invoke and execute Trigger code.
0
 

Author Closing Comment

by:anishtv
ID: 41733949
Thanks
0

Featured Post

Free Tool: SSL Checker

Scans your site and returns information about your SSL implementation and certificate. Helpful for debugging and validating your SSL configuration.

One of a set of tools we are providing to everyone as a way of saying thank you for being a part of the community.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

I remember the day when someone asked me to create a user for an application developement. The user should be able to create views and materialized views and, so, I used the following syntax: (CODE) This way, I guessed, I would ensure that use…
Checking the Alert Log in AWS RDS Oracle can be a pain through their user interface.  I made a script to download the Alert Log, look for errors, and email me the trace files.  In this article I'll describe what I did and share my script.
This video explains at a high level with the mandatory Oracle Memory processes are as well as touching on some of the more common optional ones.
This video explains at a high level about the four available data types in Oracle and how dates can be manipulated by the user to get data into and out of the database.

618 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question