"pl sql trigger determine if insert or update or delete" Code Answer's
You're definitely familiar with the best coding language SQL that developers use to develop their projects and they get all their queries like "pl sql trigger determine if insert or update or delete" answered properly. Developers are finding an appropriate answer about pl sql trigger determine if insert or update or delete related to the SQL coding language. By visiting this online portal developers get answers concerning SQL codes question like pl sql trigger determine if insert or update or delete. Enter your desired code related query in the search bar and get every piece of information about SQL code related question on pl sql trigger determine if insert or update or delete.
pl sql trigger determine if insert or update or delete
CREATE OR REPLACE TRIGGER Audit_emp
AFTER INSERT OR UPDATE OR DELETE ON Emp_tab
FOR EACH ROW
DECLARE
Time_now DATE;
Terminal CHAR(10);
BEGIN
-- get current time, and the terminal of the user:
Time_now := SYSDATE;
Terminal := USERENV('TERMINAL');
-- record new employee primary key
IF INSERTING THEN
INSERT INTO Audit_table
VALUES (Audit_seq.NEXTVAL, User, Time_now,
Terminal, 'Emp_tab', 'INSERT', :new.Empno);
-- record primary key of the deleted row:
ELSIF DELETING THEN
INSERT INTO Audit_table
VALUES (Audit_seq.NEXTVAL, User, Time_now,
Terminal, 'Emp_tab', 'DELETE', :old.Empno);
-- for updates, record the primary key
-- of the row being updated:
ELSE
INSERT INTO Audit_table
VALUES (audit_seq.NEXTVAL, User, Time_now,
Terminal, 'Emp_tab', 'UPDATE', :old.Empno);
-- and for SAL and DEPTNO, record old and new values:
IF UPDATING ('SAL') THEN
INSERT INTO Audit_table_values
VALUES (Audit_seq.CURRVAL, 'SAL',
:old.Sal, :new.Sal);
ELSIF UPDATING ('DEPTNO') THEN
INSERT INTO Audit_table_values
VALUES (Audit_seq.CURRVAL, 'DEPTNO',
:old.Deptno, :new.DEPTNO);
END IF;
END IF;
END;
All those coders who are working on the SQL based application and are stuck on pl sql trigger determine if insert or update or delete can get a collection of related answers to their query. Programmers need to enter their query on pl sql trigger determine if insert or update or delete related to SQL code and they'll get their ambiguities clear immediately. On our webpage, there are tutorials about pl sql trigger determine if insert or update or delete for the programmers working on SQL code while coding their module. Coders are also allowed to rectify already present answers of pl sql trigger determine if insert or update or delete while working on the SQL language code. Developers can add up suggestions if they deem fit any other answer relating to "pl sql trigger determine if insert or update or delete". Visit this developer's friendly online web community, CodeProZone, and get your queries like pl sql trigger determine if insert or update or delete resolved professionally and stay updated to the latest SQL updates.