Q1
True / FalseIn ORACLE, a trigger is a PL/SQL block that automatically executes in response to specific events on a table or view.
Triggers are special PL/SQL blocks that are automatically executed when certain events, such as INSERT, UPDATE, or DELETE, occur on a specified table or view.
Q2
True / FalseIn ORACLE, triggers can only be set to fire before an event occurs.
Triggers in ORACLE can be set to fire before or after an event occurs.
Q3
True / FalseIn ORACLE, a trigger can only be associated with one table.
Each trigger is associated with a single table or view, though multiple triggers can be defined for different events on the same table.
Q4
True / FalseIn ORACLE, triggers can be used to enforce complex business rules that cannot be enforced by constraints alone.
Triggers can enforce complex business rules and validations that go beyond what standard database constraints can handle.
Q5
True / FalseIn ORACLE, it is possible to create a trigger that fires for each row affected by a DML statement.
Row-level triggers fire once for each row affected by a DML statement, allowing detailed control over row-level operations.
Q6
True / FalseIn ORACLE, triggers cannot call stored procedures.
Triggers can call stored procedures, enabling complex logic to be executed as part of the trigger action.
Q7
True / FalseIn ORACLE, you can create a trigger that fires for DDL events, such as CREATE or ALTER statements.
ORACLE supports DDL triggers that can fire in response to DDL events like CREATE, ALTER, or DROP statements.
Q8
True / FalseIn ORACLE, a trigger can be defined to execute after a database startup event.
System-level triggers can be defined to execute on database events such as startup, shutdown, or user logon.
Q9
True / FalseIn ORACLE, the WHEN clause in a trigger definition allows conditional execution of the trigger logic.
The WHEN clause specifies a condition that must be met for the trigger to execute, providing more granular control over trigger execution.
Q10
True / FalseIn ORACLE, mutating table errors occur when a row-level trigger tries to read or modify a table that is currently being modified by the statement that fired the trigger.
Mutating table errors occur when a row-level trigger attempts to query or modify the table that is currently being modified by the triggering statement, causing inconsistencies.
Q12
Multiple ChoiceSelect the SQL statements that correctly create an AFTER UPDATE trigger in Oracle.
An AFTER UPDATE trigger is executed after an UPDATE operation on a table. The correct SQL statements will define the trigger with the appropriate timing and event, and include logic to log the changes.
Q14
Multiple ChoiceIdentify the SQL statements that correctly create a compound trigger in Oracle.
Compound triggers allow you to define multiple timing points within a single trigger. The correct SQL statements will include sections for each timing point, such as BEFORE and AFTER events.
Q23
Single ChoiceHow can you create a trigger to log changes to a specific column in a separate audit table?
SQL Code
CREATE OR REPLACE TRIGGER log_salary_changes
AFTER UPDATE OF salary ON employees
FOR EACH ROW
BEGIN
INSERT INTO salary_audit (employee_id, old_salary, new_salary, change_date)
VALUES (:OLD.employee_id, :OLD.salary, :NEW.salary, SYSDATE);
END;
An AFTER UPDATE trigger is used to log changes by inserting the old and new values, along with a timestamp, into an audit table.