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 |
Which command is used to delete a package?
What is a self join ?
Which table is left in left join?
What are schema-level triggers?
what is msql? : Sql dba
What is a REF CURSOR? Compare strong and week ref cursor types.
What is normalization and types of normalization?
22 Answers Etisbew, F-TEC, Microsoft, TechProcess,
what is the use of set statement in tsql? : Transact sql
Can %notfound return null after a fetch?
declare lowerl number:= 1; upperl number:= 3; num varchar2(10); begin for i into lowerl..upperl loop num:=num||to_char(lowerl); if i=3 then upperl:=5; end loop; message(num); What will be the output ?
how many no of table can be join in a sql query.
What is cross join example?
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)