What are triggers, and when would you use them?
Answers were Sorted based on User's Feedback
Answer / nashiinformaticssolutions
A trigger is a block of PL/SQL code automatically executed in response to certain events (e.g., INSERT, UPDATE, DELETE) on a table.
Example Trigger:
CREATE OR REPLACE TRIGGER EmployeeAudit
AFTER INSERT ON employees
FOR EACH ROW
BEGIN
INSERT INTO audit_log(employee_id, action, action_date)
VALUES (:NEW.id, 'INSERT', SYSDATE);
END;
| Is This Answer Correct ? | 0 Yes | 0 No |
Answer / glibwaresoftsolutions
A trigger is a block of PL/SQL code automatically executed in response to certain events (e.g., INSERT, UPDATE, DELETE) on a table.
Example Trigger:
CREATE OR REPLACE TRIGGER EmployeeAudit
AFTER INSERT ON employees
FOR EACH ROW
BEGIN
INSERT INTO audit_log(employee_id, action, action_date)
VALUES (:NEW.id, 'INSERT', SYSDATE);
END;
| Is This Answer Correct ? | 0 Yes | 0 No |
A trigger is a block of PL/SQL code automatically executed in response to certain events (e.g., INSERT, UPDATE, DELETE) on a table.
Example Trigger:
CREATE OR REPLACE TRIGGER EmployeeAudit
AFTER INSERT ON employees
FOR EACH ROW
BEGIN
INSERT INTO audit_log(employee_id, action, action_date)
VALUES (:NEW.id, 'INSERT', SYSDATE);
END;
| Is This Answer Correct ? | 0 Yes | 0 No |
Is not null in sql?
How to remove duplicate rows from a table?.
how to shut down the server with 'mysqladmin'? : Sql dba
Which tcp/ip port does sql server run on? How can it be changed? : Sql dba
What are the attributes of SQL*PLUS ?
2 Answers Dream Careers, Oracle,
What is parameter substitution in sql?
Name Salary Abc 50000 Abc 50000 xyz 20000 find the max salary using aggregate function?
What is t sql in sql server?
What is blind sql injection?
write an sql query to get third maximum salary of an employee from a table named employee_table. : Sql dba
What is a dirty read sql?
How do I make my sql query run faster?
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)