Rungta International Journal of Computer Science and Information Technology 3 (1&2), 2018, 9-14 http://www.publishingindia.com/ijcsit Triggering Security Features of Oracle Ankur N. Shah Assistant TriggeringProfessor, CE Department, SecurityBabaria Institute of Technology, Features Vadodara, Gujarat,of Oracle India. Email : [email protected] Ankur N. Shah

Abstract: triggerAssistant is a Professor, PL/SQL CEblock Department, that is BabariaTriggers Institute are storedof Technology, in the database Vadodara, separately Gujarat, India. from their executed on an event in the database. The event is related to associated tables. Triggers can be defined only on tables, not a particular data manipulation of a such as inserting,Email : [email protected] views. However, triggers on the base table(s) of a are deleting or updating a of a table [8]. Triggers are fired if an INSERT, UPDATE, or DELETE statement is issued automatically fired when condition written for trigger is against a view [12]. matched.Abstract: Thus Database it provides trigger security is a toPL/SQL database block by thatavoiding is executed Triggers are stored in the database separately from their associated harmfulon an operations event in the on database. database. The Theevent triggers is related are to a alsoparticular tables.II. TriggersHow T r caniggers be defined are U sed only on tables, not on views. cascading,data manipulationso trigger can of be acalled table by such another as inserting, trigger. There deletin g or However, triggers on the base table(s) of a view are fired if an are alsoupdating various a rowtypes of ofa tabletriggers [8]. available.Triggers are Even automatically there are firedIn many cases,INSERT, triggers UPDATE, supplement or DELETE the standard statement capabilities is issued ofagainst a view when condition written for trigger is matched. Thus it provides [12]. various advantages of using trigger, the excessive use of Oracle to provide a highly customized database management security to database by avoiding harmful operations on triggers can result in complex interdependences, which may system. For example, a trigger can permit DML operations database. The triggers are also cascading, so trigger can be be difficultcalled toby maintainanother intrigger. a large There application. are also So itvarious advisable types ofagainst a table only if they are issued during regular business II. HOW TRIGGERS ARE USED to usedtriggers trigger available. when they Even are there really are needed. various advantages of usinghours. The standard security features of Oracle, roles and In many cases, triggers supplement the standard capabilities of trigger, the excessive use of triggers can result in complexprivileges, govern which users can submit DML statements Keywords: Procedure, Security, Trigger. Oracle to provide a highly customized database management interdependences, which may be difficult to maintain in a largeagainst the table. In addition, the trigger further restricts DML system. For example, a trigger can permit DML operations against application. So it advisable to used trigger when they are reallyoperations to occur only at certain times during weekdays. Nomenclature: a table only if they are issued during regular business hours. The needed. This is just one way that you can use triggers to customize SQL - Structure standard security features of Oracle, roles and privileges, govern information management in an [12]. PL/SQLKeywords: - Procedural Procedure, Language Security, / Structural Trigger. Query Language which users can submit DML statements against the table. In In additionaddition, it can bethe usedtrigger to: further automatically restricts DML generate operations derived to occur only DML - Data Manipulation Language Nomenclature: values,at certain prevent times invalid during transactions,weekdays. This enforce is just onecomplex way that you can SQL - Structure Query Language security authorizations,use triggers to enforcecustomize referential information integrity management across in an Oracle PL/SQL - I.Procedural Introduct Languageion to / Structural Trigger Query Language nodes in adatabase distributed [12]. database, enforce complex business

DML - Data Manipulation Language rules, provide transparent event logging, provide sophisticated Database triggers are procedures that are stored in the database In addition it can be used to: automatically generate derived auditing, maintaincolumn synchronous values, prevent table invalid replicates, transactions, gather statistics enforce complex and are implicitly executedI. INTRODUCTION (fired) when the TO contents TRIGGER of a table on table accesssecurity etc. authorizations, [12]. enforce across nodes in are changed.Database Triggerstriggers are are procedures executed that when are stored an , in the database and a , enforce complex business rules, provide are implicitly executed (fired) when the contents of a table are or is issued against a table from SQL or through an transparent eventenef logging,its of providerigger sophisticated auditing, maintain changed. Triggers are executed when an insert, update or delete is III. B T application. The major point that make these triggers stand synchronous table replicates, gather statistics on table access etc. issued against a table from SQL or through an application. The alone is that they are fired implicitly (i.e. internally) by Oracle ∑∑ A trigger[12]. can permit DML statements against a table only major point that make these triggers stand alone is that they are itself and not explicitly called by the user, as done in normal if they are issued during regular business hours or on fired implicitly (i.e. internally) by Oracle itself and not explicitly predetermined weekdays. procedures [9]. III. BENEFITS OF TRIGGER called by the user, as done in normal procedures [9]. ∑∑ A trigger can also be used to keep an audit trail of a table For example, Fig. 1 shows a database application with some For example, Fig. 1 shows a database application with some SQL (i.e. store theA modified trigger can and permit deleted DML records statements of the against table) a table only SQL statements that implicitly fire several triggers stored in the along with the operation performed and the time on which databasestatements [12]. that implicitly fire several triggers stored in the database if they are issued during regular business hours or on [12]. the operationpredetermined was performed. weekdays. ∑∑ It can be used A to trigger prevent can invalid also be transactions. used to keep an audit trail of a table ∑∑ Enforce complex(i.e. storesecurity the authorizations modified and deleted[9]. records of the table) along with the operation performed and the time on which the operation was performed. IV. Safety Measures of Trigger  It can be used to prevent invalid transactions. ∑∑ When a trigger Enforce is fired, complex a SQL security statement autho insiderizations the trigger [9]. can also fired the same or some other trigger, called cascading, which mustIV. SbeAFETY considered MEASURES [9]. OF TRIGGER ∑∑ Unnecessary use of triggers for customizing the database can result in complex interdependencies between the  When a trigger is fired, a SQL statement inside the trigger Fig. 1: Triggers triggers, whichcan mayalso befired difficult the same to or maintain some other in a trigger, large called Fig. 1: Triggers applications [9].cascading, which must be considered [9]. Article can be accessed online at http://www.publishingindia.com 10 Rungta International Journal of Computer Science and Information Technology Volume 3, Issue 1&2, 2018

V. Difference between Procedure and Trigger without dropping it. ∑∑ We can execute a whenever we want Trigger-name is the name of the trigger to be created. with the help of the exec command, but a trigger can only  Unnecessary use of triggers for customizing the database canbe executed result in whenever complex an interdependencies event (insert, delete, between and update) the triggers,is fired whichon the maytable beon difficultwhich the to trigger maintain is defined. in a large ∑∑applicationsStored procedures [9]. are used for performing tasks. Stored procedures are normally used for performing user specified tasks. They can have parameters and return IFFERENCE BETWEEN ROCEDURE AND V.multiple D results sets. While theP Triggers for auditing work: Triggers normally TareRIGGER used for auditing work. They can be used to trace the activities of table events.  When a trigger is fired, a SQL statement inside the trigger can also fired the same or some other trigger, called VI. Parts of Trigger cascading, which must be considered.  ∑∑UnnecessaryA Triggering use Event of triggers or Statement for customizing - It is a SQL the statementdatabase canthat result causes in a complex trigger to interdependencies be fired. It can between insert, the update triggers,or delete which statement may be for difficult a specific to maintain table. in A triggering a large applications.statement can also specify multiple DML statements. ∑∑ A Trigger Restriction - A trigger restriction specifies a Boolean expressionVI. PARTS that O mustF TRI beGGER TRUE for the trigger Fig. 2: Create Trigger Statement to fire. It is an option available for triggers that are fired Fig. 2: Create Trigger Statement for each row. Its function is to conditionally control the  A Triggering Event or Statement - It is a SQL statement VIII. KEYWORDS AND PARAMETERS execution of a trigger. A trigger restriction is specified that causes a trigger to be fired. It can insert, update or VIII. Keywords and Parameters deleteusing astatement WHEN clause.for a specific table. A triggering OR REPLACE recreates the trigger if it already exists. You can use ∑∑statementA Trigger can Action also specify - A trigger multiple action DML is the statements. procedure that BEFOREthis o indicatesption to changethat Oracle the firesdefinition the trigger of an beforeexisting executing trigger without  A containsTrigger theRestriction SQL statements - A trigger and restriction PL/SQL codespecifies to bea the triggeringdropping it.statement. Booleanexecuted expression when a triggeringthat must bestatement TRUE isfor issued the trigger and theto AFTER indicates that Oracle fires the trigger after executing the fire.trigger It is restrictionan option evaluatedavailable forto TRUE. triggers It thatcan arecontain fired SQL for Trigger-name is the name of the trigger to be created. triggering statement. eachand row. PL/SQL Its functionstatements; is can to conditionally define PL/SQL control language the executionconstructs of and a trigger. can call A stored trigger procedures. restriction Additionally,is specified DELETEBEFORE indicates indicates that that Oracle Oracle fires fires thethe trigger trigger before whenever executing a the usingfor rowa WHEN triggers, clause. the statements in a trigger action have DELETEtriggering statement statement. removes a row from the table.  A accessTrigger to Actioncolumn - valuesA trigger (new action and old) is the of theprocedure current thatrow containsbeing processed. the SQL statements and PL/SQL code to be INSERTAFTER indicates indicates that that Oracle Oracle fires fires the the triggertrigger after whenever executing an the executed when a triggering statement is issued and the INSERTtriggering statement statement. adds a row to the table. trigger restriction evaluated to TRUE. It can contain SQL VII. Syntax of Trigger UPDATE indicates that Oracle fires the trigger whenever an and PL/SQL statements; can define PL/SQL language UPDATEDELETE statement indicates changes that a value Oracle in any fires column the triggerof the table. whenever a constructs and can call stored procedures. Additionally, Create or replace trigger trigger-name {before, after}{delete, DELETE statement removes a row from the table. for row triggers, the statements in a trigger action have ON Specifies the name of the table on which the trigger is to insert, update} on table-name access to column values (new and old) of the current row be created.INSERT indicates that Oracle fires the trigger whenever an [referencingbeing processed. {OLD as old, NEW as new}] INSERT statement adds a row to the table. REFERENCING specifies correlation names. You can use [for each row / statement [when condition]] correlation names in the PL/SQL block and WHEN clause of VII. SYNTAX OF TRIGGER UPDATE indicates that Oracle fires the trigger whenever an declare a row triggers to refer specifically to old and new values of the UPDATE statement changes a value in any column of the table. variable declaration; create or replace trigger trigger-name {before, after}{delete, insert, current row. The default correlation names are OLD and NEW. If update} on tableconstant-name declaration; yourON row Specifies trigger is theassociated name ofwith the a table named on which OLD the or triggerNEW, is to be you can use this clause to specify different correlation names to [referencingbegin {OLD as old, NEW as new}] created. [for each row / statement [when condition]] avoid confusion between table name and the correlation name. pl/ subprogram body; declare FORREFERENCING EACH ROW designates specifies the correlation trigger to benames. a row trigger.You can use exception variable declaration; Oraclecorrelation fires a names row intrigger the PL/SQL once block for andeach WHEN row that clause is of affected a row constantexception declaration; pl/sql block; by thetriggers triggering to refer statement specifically and tomeets old andthe newoptional values trigger of the current begin end;[9] constraintrow. The defined default in correlation the when clause.names areIf youOLD omit and this NEW. clause, If your row pl/sql subprogram body; trigger is associated with a table named OLD or NEW, you can use the trigger is a statement trigger. exceptionFollowing Fig. 2 is useful to understand create trigger statement this clause to specify different correlation names to avoid [13].exception pl/sql block; WHENconfusion Specifies between the trigger table namerestriction. and the The correlation trigger restriction name. end;[9] contains a SQL condition that must be satisfied for Oracle to OR REPLACE recreates the trigger if it already exists. You can fire FORthe trigger. EACH ROWThis condition designates must the containtrigger tocorrelation be a row trigger.names Oracle use this option to change the definition of an existing trigger Following Fig. 2 is useful to understand create trigger statement and firescannot a contain row trigger a query. once You for can each specify row trigger that isrestriction affected by the [13]. triggering statement and meets the optional trigger constraint defined in the when clause. If you omit this clause, the trigger is a statement trigger.

WHEN Specifies the trigger restriction. The trigger restriction contains a SQL condition that must be satisfied for Oracle to fire the trigger. This condition must contain correlation names and cannot contain a query. You can specify trigger restriction only for Triggering Security Features of Oracle 11

only for the row triggers. Oracle evaluates these conditions for ∑∑ INSTEAD OF Triggers - INSTEAD OF triggers each row affected by the triggering statement. provide a transparent way of modifying views that cannot be modified directly through DML statements PL/SQL block is the PL/SQL block that oracle executes to fire (INSERT, UPDATE, and DELETE). These triggers are the trigger [9]. called INSTEAD OF triggers because, unlike other types of triggers, Oracle fires the trigger instead of executing the row triggers. Oracle I evaluatesX. Types these of T conditionsriggers for each row the triggeringof triggers, statement. Oracle fires the trigger instead of executing the affected by the triggering statement. triggering statement. ∑∑ Row Triggers and Statement Triggers - When you

define a trigger, you can specify the number of times the rigger ype ombinations PL/SQL block is the PL/SQL block that oracle executes to fire the X. T T C trigger action is to be run: Once for every row affected X. TRIGGER TYPE COMBINATIONS trigger [9]. by the triggering statement, such as a trigger fired by We can also combine trigger type like, before statement trigger, an UPDATE statement that updates many rows. Once beforeWe can row also trigger combine etc. trigger type like, before statement trigger, IX. TYPES OF TRIGGERS for the triggering statement, no matter how many rows before row trigger etc.

 Rowit Triggers affects. and Statement Triggers - When you define XI. Cascading Trigger XI. CASCADING TRIGGER a∑ ∑trigger,Row Triggersyou can -specify A row thetrigger number is fired of times each thetime trigger the table

actionis affected is to be by run: the Once triggering for every statement. row aff ectedFor example, by the if When trigger is fired, SQL statements within a trigger have When trigger is fired, SQL statements within a trigger have ability triggeringan UPDATE statement, statement such updates as amultiple trigger rows fired of a bytable, ability to fire another trigger. It is shown in Fig. 3. When a to fire another trigger. It is shown in Fig. 3. When a statement in a an UPDATEa row trigger statement is fired that updates once manyfor rows.each Once row affectedfor by statement in a trigger body causes another trigger to be fired, trigger body causes another trigger to be fired, the triggers are said the the triggering UPDATE statement, statement. no If matter a triggering how manystatement rows affects it theto betriggers cascading are said [12] to. be cascading [12]. affectsno rows, a row trigger is not run. Row triggers are useful  Rowif Triggers the code - inA therow trigger trigger action is fired depends each time on thedata table provided is affectedby the by triggering the triggering statement statement. or rows thatFor are example, affected. if an∑∑ UPDATEStatement statement Triggers updates - A statement multiple triggerrows of is a table, fired a once row on trigger behalf isof firedthe triggering once for statement, each row regardless affected of by the the UPDATEnumber of statement. rows in the If tablea triggering that the statementtriggering affectsstatement no rows,affects, a row even trigger if no is rowsnot run. are Row affected. triggers For are example, useful if if thea DELETEcode in the statement trigger action deletes depends several on rows data from provided a table, by thea statement-leveltriggering statement DELETE or rows trigger that are is affected. fired only once.  StatementStatement Triggers triggers - A arestatement useful triggerif the codeis fired in oncethe triggeron behalfaction of doesthe triggering not depend statement, on the dataregardless provided of bythe the numbertriggering of rows statement in the table or the that rows the triggeringaffected. Forstatement example, affects,use a even statement if no trigger rows to: are Make affected. a complex For example, security check if a DELETEon the current statement time deletes or user. several Generate rows a singlefrom aaudit table, record. a statementBEFORE-level andDELETE AFTER trigger Triggers is fired only- Whenonce. defining Statementa trigger, triggers you are can useful specify if the thecode triggerin the triggertiming - actionwhether does not the depend trigger on action the data is provided to be run by thebefore Fig. 3: Cascading Triggers triggeringor after statement the triggering or the rows statement. affected. ForBEFORE example, and Fig. 3: Cascading Triggers use aAFTER statement apply trigger to to: both Make statement a complex and security row check triggers. While triggers are useful for customizing a database, you should on the current time or user. Generate a single audit record While triggers are useful for customizing a database, you should BEFORE and AFTER triggers fired by DML statements onlyonly use use triggers triggers when when necessary. necessary. The The excessive excessive useuse ofof triggerstriggers can  BEFOREcan be and defined AFTER Triggersonly on - tables,When defin not ing on a views.trigger, However, result in complex interdependences, which may be difficult to can result in complex interdependences, which may be difficult you triggerscan specify on thethe basetrigger tables timing of— awhether view are the fired trigger if an maintain in a large application [12]. actionINSERT, is to UPDATE,be run before or DELETE or after statement the triggering is issued to maintain in a large application [12]. statement. BEFORE and AFTER apply to both statement against the view. BEFORE and AFTER triggers fired by XII. EXAMPLES OF TRIGGER and row triggers. xamples of rigger DDL statements can be defined only on the database or a XII. E T BEFOREschema, and not AFTER on particular triggers tables. fired by DML statements can be defined only on tables, not on views. However, First we create sailor table as shown below. ∑∑ BEFORE Triggers - BEFORE triggers run the trigger First we create sailor table as shown below. triggers on the base tables of a view are fired if an action before the triggering statement is run. This type INSERT, UPDATE, or DELETE statement is issued createcreate table table sailor(sid sailor(sid number(3), number(3), sname sname varchar2(30), varchar2(30), rating rating of trigger is commonly used in the following situations: against the view. BEFORE and AFTER triggers fired by number(2),number(2), age age number(3)); number(3)); When the trigger action determines whether the triggering DDL statements can be defined only on the database or a statement should be allowed to complete. Using Now we insert few records in sailor table. schema, not on particular tables. Now we insert few records in sailor table. a BEFORE trigger for this purpose, you can eliminate insert into sailor values(1,’veer’, 5, 20);  BEFORE Triggers - BEFORE triggers run the trigger unnecessary processing of the triggering statement and its action before the triggering statement is run. This type of insertinsert into into sailor sailor values(2,’vinay’, values(1,'veer', 5, 7, 20); 22); eventual rollback in cases where an exception is raised in trigger is commonly used in the following situations: the trigger action. To derive specific column values before insert into sailor values(3,’raja’, 15, 18); When the trigger action determines whether the triggering insert into sailor values(2,'vinay', 7, 22); statemencompletingt should a triggering be allowed INSERT to or complete.UPDATE statement. Using Now if we look sailor table it is look as below. ∑∑ AFTER Triggers - AFTER triggers run the trigger action insert into sailor values(3,'raja', 15, 18); a BEFORE trigger for this purpose, you can eliminate * from sailor; unnecessaryafter the processingtriggering statementof the triggering is run. statement and its eventual rollback in cases where an exception is raised in Now if we look sailor table it is look as below. the trigger action. To derive specific column values before completing a triggering INSERT or UPDATE statement. select * from sailor;

 AFTER Triggers - AFTER triggers run the trigger action SID SNAME RATING AGE after the triggering statement is run. 1 Veer 5 20  INSTEAD OF Triggers - INSTEAD OF triggers provide a transparent way of modifying views that cannot be 2 Vinay 7 22 modified directly through DML statements 3 Raja 15 18 (INSERT, UPDATE, and DELETE). These triggers are called INSTEAD OF triggers because, unlike other types Now we create one another table sailor_history as shown below. 12 Rungta International Journal of Computer Science and Information Technology Volume 3, Issue 1&2, 2018

SID SNAME RATING AGE raise_application_error(-20001, ‘try on any weekdays’); 1 Veer 5 20 end if; 2 Vinay 7 22 3 Raja 15 18 end; ∑∑ Write a trigger that is fired before the DML statement’s Now we create one another table sailor_history as shown below. execution on the employee table. The trigger checks the create table sailor_history(sid number(3), sname varchar2(30)); day based on sysdate. If the day is Sunday, the trigger Now we create one trigger known as sailor_delete which used does not allow the DML statement’s execution and to keep history of sailors those are deleted from sailor table. We raises an exception. Write the appropriate message in the keep these records into sailor_history table. exception handling section. Create or replace trigger sailor_delete after delete on sailor for Tables: employees (employeeid, lname, fname, positioned, each row supervisor, hiredate, salary, commission, deptid, qualid) begin dept (deptid, deptname, location, employeeid) insert into sailor_history values(:OLD.SID, :OLD. create or replace trigger day_chk before insert or update or SNAME); delete or select on employee dbms_output.put_line(‘Record deleted successfully from sailor table and kept in sailor_history table successfully’); declare end; msg exception; Now we delete record from sailor table as shown below. begin delete from sailor where sid=1; if to_char (sysdate,’day’) = ‘sunday’ or Due to trigger sailor_delete we get following output and two to_char (sysdate,’hh:mm a.m.’) < ‘8:00 a.m.’ or tables look as below. to_char (sysdate,’hh:mm p.m.’) >= ‘5:00 p.m.’ Record deleted successfully from sailor table and kept in then sailor_history table successfully raise msg; 1 row(s) deleted. end if; Now, exception select * from sailor; gives us, when msg then SID SNAME RATING AGE dbms_output.put_line (‘‘changes to employee 2 Vinay 7 22 table allowed only during business hours’); 3 Raja 15 18 end; Now, ∑∑ Write a database before / insert or update / row trigger to check distance between the origin and destination would select * from sailor_history; gives us, not be greater than 2000 km. SID SNAME Tables: route_header (route_id number (5), route_no number (5), destination varchar2 (20), fare number(5,2)) 1 Veer create or replace trigger dis_chk before insert or update on Following are some other examples of triggers. route_header for each row ∑∑ Write a database trigger before insert for each row on the declare table route_detail not allowing transaction on Saturday and Sundays. msg exception; Table: route_detail (rid, from, to, shipping_date) d route_header.distance % type; create or replace trigger sun_trig before insert or update or rid route_header.route_id % type; delete on route_detail. begin declare select distance into d from route_header where shipping_date char; route_id=&rid; begin if d > 2000then shipping_date := to_char(sysdate, ‘dy’); raise msg; if shipping_date in (‘sat’, ‘sun’) then end if; Triggering Security Features of Oracle 13 exception XV. Remove Triggers when msg then dbms_output.put_line (‘you cannot insert or update When trigger is no longer needed it can be removed using drop values for distance which is greater than 2000 km.’); trigger command as shown below [8]. end; drop trigger sun_trig;

XIII. Execution Sequence of Database Triggers XVI. View Information about Triggers

The following Fig. 4 shows the execution sequence of database Following example shows how to view information about triggers. trigger. SELECT Trigger_type, Triggering_event, Table_name FROM AFTER STATEMENT INSERT PART USER_TRIGGERS WHERE Trigger_name = ‘PART’;

TRIGGER_TYPESELECT Trigger_bodyTRIGGERING_ FROMTABLE_ USER_TRIGGERS WHERE Trigger_name=EVENT 'PART'; NAME AFTER STATEMENTResult: INSERT PART

SELECT Trigger_body FROM USER_TRIGGERS WHERE TRIGGER_BODY Trigger_name= ‘PART’; ------Result: BEGIN TRIGGER_BODY ------DBMS_OUTPUT.PUT_LINE('The insert in part table is successful '); BEGIN DBMS_OUTPUT.PUT_LINE(‘TheEND; insert in part table is successful ‘); 1 row selected [11]. END; 1 row selected [11]. XVII. CONCLUSION

Fig. 4: Execution Sequence for Database Triggers Database triggers are used to implement complex business rules XVII. Conclusion Fig. 4: Execution Sequence for Database Triggers that cannot be implemented using integrity constraints. Triggers can also be used for logging and to take actions that should be XIV. ENABLING AND DISABLING TRIGGERSDatabase triggersautomatical are usedly performed.to implement Trigger complex may businessbe fired before the DML XIV. Enabling and Disabling Triggers rules that cannotoperation be implemented or after DML using operation. integrity Triggerconstraints. may be fired for each A database trigger is in either enable state or disable state.Triggers can alsorow be affected used for by logging the DML and operationto take actions or for that the entire statement. A database trigger is in either enable state or disable state. Disabling trigger may improve performance when large amountshould of be automaticallyINSTEAD performed.-OF trigger Trigger are called may be instead fired ofbefore executing the given Disablingtable data trigger is to may be modified improve becaus performancee trigger whencode is large not executedthe DML operationDML command.or after DML They operation. are defined Trigger on relational may be -views and object- amount[8] .of table data is to be modified because trigger code is fired for eachviews. row A triggeraffected can bybe disabled the DMLto increase operation the orperformance forthe when not executed [8]. entire statement.a lot INSTEAD-OFof data manipulations trigger are are to calledbe done instead on the table. Trigger is For example, Update emp set name = upper(name); For example, Update emp set name = upper(name); of executing thealso given used DML to provide command. security They as are condition defined is violatedon then it is relational-viewsautomatically and object-views. fired. A trigger can be disabled to Run Run faster faster if all if all triggers triggers fired fired by update update on onemp emptable table are disabled. are increase the performance when a lot of data manipulations are disabled.Using Using alter alter command command we we can can enable enable or or disable disable trigger, trigger, as shown to be done on the table. Trigger is also used to provide security as shownbelow, below, REFERENCES as condition is [1]violated A. Behrend, then it isC. automatically Dorau, and R. fired. Manthey, “SQL triggers reacting alter trigger sun_trigalter trigger disable; sun_trig disable; on time events: An extension proposal,” in J. Grundspenkis, T. This Thiscommand command will disablewill disable sun_trig sun_trig trigger. trigger. Morzy, andReferences G. Vossen, (eds), Advances in and Use following command to enable any trigger. Information Systems (ADBIS 2009), Lecture Notes in Computer [1] A. Behrend,Science C. , Dorau,vol. 5739, and Springer, R. Manthey, Berlin, “SQL Heidelberg, triggers 2009. Use alterfollowing trigger command sun_trig enable;to enable any trigger. reacting on time events: An extension proposal,” in J. alter trigger sun_trig enable; Following command will disable all triggers on emp table. Grundspenkis, T. Morzy, and G. Vossen, (eds), Advances [2] L. Pamulaparty, T. P. Kumar, and P. V. B. Varma, “A survey: in Databases and Information Systems (ADBIS 2009), Followingalter table command emp disable will disable all triggers; all triggers on emp table. Security perspectives of ORACLE and IBM-DB2 databases,” alter table emp disable all triggers; International Journal of Scientific and Research Publications, vol. 3, no. 1, January 2013.

EMOVE RIGGERS XV. R T [3] D. Lee, W. Mao, H. Chiu, and W. W. Chu, “Designing triggers with trigger-by-example,” Knowledge and Information Systems, When trigger is no longer needed it can be removed using drop vol. 7, no. 1, pp. 110-134, 2005. trigger command as shown below [8]. drop trigger sun_trig; [4] J. J. King, “Oracle 11g/10g for developers: What you need to know,” Session S300195, King trainging resources, 2008. XVI. VIEW INFORMATION ABOUT TRIGGERS [5] An Oracle white paper, “Oracle Database Security Checklist,” Following example shows how to view information about trigger. June 2008.

SELECT Trigger_type, Triggering_event, Table_name FROM [6] A. Kornbrust, “Best Practices for Oracle Databases Hardening USER_TRIGGERS WHERE Trigger_name = 'PART'; Oracle 10.2.0.3 / 10.2.0.4,” N. D.

TRIGGER_TYPE TRIGGERING_EVENT TABLE_ [7] I. Bayross, SQL, PL/SQL the Programming Language of NAME Oracle, N. D.

14 Rungta International Journal of Computer Science and Information Technology Volume 3, Issue 1&2, 2018

Lecture Notes in Computer Science, vol. 5739, Springer, [6] A. Kornbrust, “Best Practices for Oracle Databases Berlin, Heidelberg, 2009. Hardening Oracle 10.2.0.3 / 10.2.0.4,” N. D. [2] L. Pamulaparty, T. P. Kumar, and P. V. B. Varma, “A [7] I. Bayross, SQL, PL/SQL the Programming Language of survey: Security perspectives of ORACLE and IBM- Oracle, N. D. DB2 databases,” International Journal of Scientific and [8] Oracle for beginners, “Ch-20 Database Triggers,” N. D. Research Publications, vol. 3, no. 1, January 2013. srikanthtechnologies.com [3] D. Lee, W. Mao, H. Chiu, and W. W. Chu, “Designing [9] A. N. Shah “RDBMS,” Mahajan Publication, 2011. triggers with trigger-by-example,” Knowledge and [10] “Oracle,” Atmiya Infotech Pvt Ltd. Information Systems, vol. 7, no. 1, pp. 110-134, 2005. [11] “PL/SQL Triggers,”. Available: http://docs.oracle.com/ [4] J. J. King, “Oracle 11g/10g for developers: What you need cd/E11882_01/appdev.112/e25519/triggers.htm to know,” Session S300195, King trainging resources, [12] “Database Triggers - Oracle7 Server Concepts Manual,”. 2008. Available: docs.oracle.com/cd/A57673_01/DOC/server/ [5] An Oracle white paper, “Oracle Database Security doc/SCN73/ch15.htm? Checklist,” June 2008. [13] “Create Trigger,”. Available: http://www.sqlite.org/lang_ createtrigger.html