PL/SQL Interview Questions and Answers For Graduates Part-4
A trigger cannot execute the COMMIT, ROLLBACK, or SAVEPOINT commands.
32.What is the use of a WHEN clause in a trigger?
A WHEN clause specifies the condition that must be true for the trigger to be triggered.
33.Say True or False. If False, explain why.
Statement level triggers are triggered only once.
34.What is the purpose of the optional argument [OR REPLACE] in a CREATE TRIGGER command?
The optional argument [OR REPLACE] in a CREATE TRIGGER command re-creates an existing trigger. Using this option allows changing the definition of an existing trigger without having to delete it first.
35.Say True or False. If False, explain why.
INSTEAD OF is a valid option only for triggers in a table.
False. INSTEAD OF is a valid option only for views. INSTEAD OF trigger cannot be specified in a table.
36.Write a statement to disable a trigger named update_marks.
ALTER TRIGGER update_marks DISABLE;
37.Which command is used to delete a trigger?
DROP TRIGGER command.
38.Which command is used to delete a procedure?
DROP PROCEDURE command.
39.What is the difference between a function and a stored procedure?
A function returns a value and a stored procedure doesn’t return a value.
40.How do you declare a user-defined exception?
User defined exceptions are declared under the DECLARE section, with the keyword EXCEPTION. Syntax −