What are triggers, and when would you use them?

Answers were Sorted based on User's Feedback



What are triggers, and when would you use them?..

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

What are triggers, and when would you use them?..

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

What are triggers, and when would you use them?..

Answer / hr@tgksolutions.com

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

Post New Answer

More SQL PLSQL Interview Questions

What are all the difference between Like and Contains ?

2 Answers   LG Soft,


What are the two different parts of the pl/sql packages?

0 Answers  


What is the sql case statement?

0 Answers  


What is rtm in testing?

0 Answers  


How to write a query to show the details of a student from students table whose

0 Answers  






What is sql data?

0 Answers  


Create table emp (id number(9), name varchar2(20),salary number(9,2)); The table has 100 records after table created.Now i nee to change id's Datatype is to be Varchar2(15). now Alter table emp modify(id varchar2(15),name varchar2(20), salary number(9,2)); Whether it will work or returns error? post answer with explanation.

13 Answers   Oracle, TCS,


Which is faster count (*) or count 1?

0 Answers  


What can I use instead of union in sql?

0 Answers  


What is #table in sql?

0 Answers  


what are the advantages of package?

7 Answers   iFlex,


what is cursor procedure

1 Answers   iGate,


Categories