What are the differences between Database Trigger and
Integrity constraints ?
Answers were Sorted based on User's Feedback
Answer / guest
An integrity constraint defines a business rule for a table
column which automatically takes care by Oracle internally.
Intefrity Constraints are NOT NULL,UNIQUE,CHECK ,PRIMARY
KEY,FOREIGN KEY.
A database trigger is a procedure written in PL/SQL and
Will run implicitly when data is modified or when some user
or system actions occur.Triggers are database objects which
gets stored in database and get fires when INSERT or UPDATE
statement attempts to violate the integrity rule, Oracle
must roll back the statement and return an error if trigger
exists.Database triggers are BEFOR/AFTER/{BEFORE|AFTER}
{row|statement etc.
| Is This Answer Correct ? | 11 Yes | 3 No |
Answer / rao
main diff is when we use the trigger voilation rules of
trigger body will not affect existing data.but in case of
constrinat will affect the exsting data also.
| Is This Answer Correct ? | 7 Yes | 1 No |
Answer / kalyana chakravarthy
Intigrity constraints are Proactive-- Like they take the
cols into consideration before sitting on it like if U levy
a PK on a col having duplicate or null values it will not
obey to sit on that col
Triggers are reactive-- Triggres react only when a DML
occurs. When it comes and sit on a table then its starts
working and never considers what happened before it arrival
Both are used to perform business rules
| Is This Answer Correct ? | 4 Yes | 0 No |
Answer / santu sarkar
1> A database trigger is written in PL/SQL. Integrity Constraints are CHECK Constraints, Not NULL, Unique key, primary key and foreign key.
2> Trigger will not affect the existing data. Constraint will affect the existing data.
| Is This Answer Correct ? | 4 Yes | 1 No |
Is left join and outer join same?
How to update salary of employees department wise?
What is the cause of mutating table error and how can we solve it?
What is vector point function?
What are the types of keys?
what does myisamchk do? : Sql dba
Any attempt to navigate programmatically to disabled form in a call_form stack is allowed?
can use the following like overloading concept in a single package: procedure p1(a varchar), procedure p1(a varchar2), procedure p1(a char)
What is the largest value that can be stored in a byte data field?
What is the starting oracle error number? What is meant by forward declaration in functions?
What is insert command in sql?
How do you optimize a stored procedure query?
Oracle (3259)
SQL Server (4518)
MS Access (429)
MySQL (1402)
Postgre (483)
Sybase (267)
DB Architecture (141)
DB Administration (291)
DB Development (113)
SQL PLSQL (3330)
MongoDB (502)
IBM Informix (50)
Neo4j (82)
InfluxDB (0)
Apache CouchDB (44)
Firebird (5)
Database Management (1411)
Databases AllOther (288)