- Trending Categories
Data Structure
Networking
RDBMS
Operating System
Java
iOS
HTML
CSS
Android
Python
C Programming
C++
C#
MongoDB
MySQL
Javascript
PHP
Physics
Chemistry
Biology
Mathematics
English
Economics
Psychology
Environmental Science
Social Studies
Fashion Studies
Legal Studies
- Selected Reading
- UPSC IAS Exams Notes
- Developer's Best Practices
- Questions and Answers
- Effective Resume Writing
- HR Interview Questions
- Computer Glossary
- Who is Who
What is a trigger in SQL ?
A trigger is a stored program in a database which automatically gives responses to an event of DML operations done by insert, update, or delete. In other words, is nothing but an auditor of events happening across all database tables.
Let’s look at an example of a trigger :
CREATE TRIGGER bank_trans_hv_alert
BEFORE UPDATE ON bank_account_transaction
FOR EACH ROW
begin
if( abs(:new.transaction_amount)>999999)THEN
RAISE_APPLICATION_ERROR(-20000, 'Account transaction exceeding the daily deposit on SAVINGS account.');
end if;
end;
- Related Questions & Answers
- What is Primary Key in SQL ?
- What are the types of SQL Queries ?
- What is OLAP ?
- What is a unique key in SQL ?
- What is join in SQL ?
- How can I see all tables in SQL?
- How to change a table name in SQL ?
- How to insert date in SQL ?
- What is Data Integrity ?
- How to delete a column in SQL ?
- What is SQL server ?
- How to insert multiple rows in SQL ?
- What is a trigger in SQL ?
- What is Normalization in SQL ?
- What is SQL injection ?
- How do I view tables in SQL ?
Advertisements
ads