50 TOP PLSQL Triggers Interview Questions and Answers - PLSQL Interview Questions, PLSQL Objective TypeQuestions, PLSQL Tutorial PDF
50 TOP PLSQL Triggers Interview Questions and Answers - PLSQL Interview Questions, PLSQL Objective TypeQuestions, PLSQL Tutorial PDF
Home plsql Interview Questions plsql Multiple Choice Questions PLSQL Tutorial
Therefore, the INSTEAD OF triggers can be used to update the underlying tables, which are
part of the views.
They can be used on both relational views and object views. The INSTEAD OF triggers can only
be defined as row-level triggers and not as statement-level triggers.
10. What is the difference between database trigger and stored procedure?
New
The main difference between database trigger and stored procedure is that the trigger is invoked
implicitly and stored procedure is invoked explicitly.
Transaction Control statements, such as COMMIT, ROLLBACK, and SAVEPOINT, are not
allowed within the body of a trigger whereas, these statements can be included in a stored
procedure.
12. What are the events on which a database trigger can be based?
Database triggers are based on system events and can be defined at database or schema level.
The various events on which a database trigger can be based are given as follows:
Data definition statement on a database or schema object
Logging off or on of a specific user
Database shutdown or startup
On any specific error that occurs
15. Which data dictionary views have the information on the triggers that are available in
the database?
The data dictionary views that have information on database triggers are given as follows:
USER_OBJECTS —Contain the name and status of a trigger as well as the date and time of
trigger creation
USER_ERRORS—Contain the compilation error of a trigger
USER_ TRIGGERS— Contain the source code of a trigger
USER_ TRIGGER_COLS—Contain the information on columns used in triggers
It is good to disable triggers during data load operations. This improves the performance of the
data loading activities. The data modification and manipulation that the trigger would have
performed has to be done manually after the data loading.
19. Which column of the USERJTRIGGERS data dictionary view displays the database
event that will fire the trigger?
The Description column of the USERJTRIGGERS view combines information from many
columns to display the trigger header, which includes the database event.
24. What is the difference between ALTER TRIGGER and DROP TRIGGER statements?
An ALTER TRIGGER statement is used to recompile, disable, or enable a trigger; whereas, the
DROP TRIGGER statement is used to remove the trigger from the database.
25. Do triggers have restrictions on the usage of large datatypes, such as LONG and
LONG RAW?
Triggers have restrictions on the usage of large datatypes as they cannot declare or reference
the LONG and LONG RAW datatypes and cannot use them even if they form part of the object
with which the trigger is associated. Similarly, triggers cannot modify the CLOB and BLOB
objects as well; however, they can reference them for read-only access.
32. Are DDL triggers fired for DDL statements within a PL/SQL code executed using the
DBMS.SQL package?
No, DDL triggers are not executed for DDL statements, which are executed within the PL/SQL
code using the DBMS_SQL package.
35. Does USERJTRIGGERS have entry for triggers with compilation errors?
Yes, USER_TRIGGERS have entries for all triggers that are created in the schema with or
without errors.
36. Which of the following events cannot be customized with triggers?
a. INSERT INTO statement
b. CREATE TABLE statement in a schema
c. DELETE CASCADE CONSTRAINTS
d. SET PAUSE ON
Option D cannot be customized; whereas, all the other options can be customized using
triggers.
43. What does the BASE_OBJECT_TYPE column shows in the USER.TRIGGERS data
dictionary view?
The BASE_OBJECT_TYPE column identifies the type of database object with which the trigger
is associated. It shows whether the object of database is a TABLE, VIEW, SCHEMA, or
DATABASE.
46. Can INSTEAD OF triggers be used to fire once for each statement on a view?
No, INSTEAD OF triggers cannot be used for each statement however, It can only be used for
each row on a view.
47. Is it possible to include an INSERT statement on the same table to which the trigger is
assigned?
If an INSERT statement is used on the same table to which the trigger is associated, then this
will give rise to a mutating table, as it is not possible to change the same table that is already in
the process of being changed.
49. Write the ALTER statement to enable all the triggers on the T.STUDENTS table.
The ALTER statement is given as follows:
ALTER TABLE T_STUDENTS ENABLE ALL TRIGGERS;
50. Which column in the USER.TRIGGERS data dictionary view shows that the trigger is a
PL/SQL trigger?
The ACTION_TYPE column of the USER_TRIGGERS data dictionary view shows that the
trigger is a PL/SQL trigger.
4 comments:
Unknown said...
Very good collection of questions and answers thank you for sharing this
article with us. know more about PLSQL Online Training
Nice questions and very interesting information and thanks for share the
information.
oracle sql interview questions and answers for java developers
Unknown said...
Unknown said...
Hi Bru,
This is indeed great! But I think perhaps you are generally referring ,which
is getting unsustainable.
I need to check various columns of a particular table to see if they are not
really being populated or the data is always the same. So that we can
perhaps remove some columns going forward. This table will be filtered by
std_job_no column as i have a list of values for this column which pertain to
a particular area of the data.
To retrieve the column names for the table i have written this which
produces the correct results.. note i do not require std_job_no column as i
will be using this later as part of the group by query.
select
COL,UMN_NAME, COUNT(STD_JOB_NO)
from msf690
where std_job_no in (
'009045', '009053', '009188', '009189', '009190', '009236', '009275',
'009310', '009319', '009320', '009321', '009322', '009323', '009324',
'009325', '009326', '009327', '009328', '009419', '009459', '009460',
'009461', '009462', '009463', '009464', '009582', '009590', '009591',
'009594', '009616', '009617', '009618', '009619', '009620', '009621',
'009622', '009623', '009624'
)
and dstrct_code='RTK1'
GROUP BY COLUMN_NAME
So i would then get the list of all values for each column name and how
often they are populated.
DECLARE
BEGIN
FOR RRR IN (
and then i want to dbms_output this without inserting the values into a table
as I don't have permissions to create tables.
,Merci
Post a comment
AtoZ plsql Interview Questions, plsql Objective Type Questions, Study Materials for plsql.