Welcome to Scribd, the world's digital library. Read, publish, and share books and documents. See more
Download
Standard view
Full view
of .
Look up keyword
Like this
12Activity
0 of .
Results for:
No results containing your search query
P. 1
Creating DML Triggers Part II

Creating DML Triggers Part II

Ratings: (0)|Views: 1,225|Likes:
Published by Catalina Achim

More info:

Published by: Catalina Achim on May 27, 2012
Copyright:Attribution Non-commercial

Availability:

Read on Scribd mobile: iPhone, iPad and Android.
download as TXT, PDF, TXT or read online from Scribd
See more
See less

05/27/2013

pdf

text

original

 
Test:Quiz:CreatingDMLTriggers:PartII1.Whichofthefollowingbestdescribesconditionalpredicatesinatrigger? MarkforReview(1)PointsTheyarespecialvariableswhichmustbeDECLAREdwithinthetrigger.Theyallowthetriggercodetoseewhatdatavaluesarebeinginsertedintoarow.TheyareautomaticallydeclaredbooleanvariableswhichallowthetriggerbodytodetectwhichDMLoperationisbeingexecuted.(*)Theyarespecialcursorattributes,like%ROWCOUNTand%NOTFOUNDCorrect2.Examinethefollowingcode.Tocreatearowtrigger,whatcodeshouldbeincludedatLineA?CREATEORREPLACETRIGGERdel_emp_triggBEFOREDELETEONemployees----LineABEGIN...MarkforReview(1)PointsFOREVERYROWFOREACHROW(*)FOREVERYROWFORALLROWSNothingisneededbecauseDMLtriggersarerowtriggersbydefault.Correct3.Whatiswrongwiththiscompoundtriggerexample?CREATEORREPLACETRIGGERcompound_triggerFORUPDATEOFsalaryCOMPOUNDTRIGGERthresholdCONSTANTSIMPLE_INTEGER:=200;BEFOREEACHROWISBEGIN
 
--someactionENDBEFOREEACHROW;AFTEREACHROWISBEGIN--someactionENDAFTEREACHROW;AFTERSTATEMENTISBEGIN--someactionENDAFTERSTATEMENT;ENDcompound_trigger;MarkforReview(1)PointsMissingBEFOREtimingstatement.MissingtheEXCEPTIONsection.Missingnameoftableonwhichthetriggerfires.(*)MissingtheINSTEADOFtimingsection.MissingtheBEFOREandINSTEADOFtimingsections.Correct4.Whatarethetimingeventsforacompoundtrigger? MarkforReview(1)PointsBeforethetriggeringstatement;Afterthetriggeringstatement;Insteadofthetriggeringstatement.Beforethetriggeringstatement;Beforeeachrow;Aftereachrow;Afterthetriggeringstatement.(*)Beforethetriggeringstatement;Afterthetriggeringstatement;Aftereachrow.Beforethetriggeringstatement;Beforeeachrow;Afterthetriggeringstatement.Correct5.Youdecidetocreatethefollowingtrigger:CREATEORREPLACETRIGGERempl_trigg
 
BEFOREUPDATEONemployeesBEGIN--LineARAISE_APPLICATION_ERROR('Cannotupdatesalary');ELSEINSERTINTOlog_tablevalues(USER,SYSDATE);ENDIF;END;YouwantthetriggertopreventupdatestotheSALARYcolumn,butallowupdatestoallothercolumns.WhatshouldyoucodeatLineA?MarkforReview(1)PointsIFUPDATINGSALARYTHENIFUPDATING('SALARY')THEN(*)IFUPDATE('SALARY')THENIFUPDATING(SALARY)THENIFUPDATE(SALARY)THENCorrect6.Wheneveranemployee'sJOB_IDisupdated,wewanttoinsertarowintoaloggingtabletorecordtheemployee_idandthenewvalueofJOB_ID.Wecreatearowtriggerwhosebodyincludesthefollowingcode:BEGININSERTINTOlogging_table(emp_id,job_id)VALUES--PointAEND;AtpointA,whichofthefollowingwillinsertthecorrectdataintotheloggingtable?(Choosetwo.)MarkforReview(1)Points(Chooseallcorrectanswers)(:OLD.employee_id,:OLD.job_id);(:OLD.employee_id,:NEW.job_id);(*)(:NEW.employee_id,:OLD.job_id);

Activity (12)

You've already reviewed this. Edit your review.
1 hundred reads
1 thousand reads
Andreea Tirnacop liked this
Lucian Claudiu liked this
Andreea Tirnacop liked this
adnanamaria liked this
Nadira Đogić liked this
Adda Andreea liked this

You're Reading a Free Preview

Download
scribd
/*********** DO NOT ALTER ANYTHING BELOW THIS LINE ! ************/ var s_code=s.t();if(s_code)document.write(s_code)//-->