PL/SQL stands for _____procedural language extension
for Structured query language . (a3a generatie) 2. PL/SQL is a _3a generatie_____ programming language. 3. The PL/SQL language uses which of the following (circle answer! a. ". c. d. Variables Cursors Conditional logic #ata definition language $. The "asic unit in a PL/SQL program is a __________.block %. PL/SQL allows &ou to logicall& com"ine multiple SQL statements as one unit or "loc'. The application can send the entire "loc' to the data"ase instead of sending the SQL statements one at a time. This significantl& reduces the num"er of data"ase calls. (True or (alse ). *ame the three sections of a PL/SQL "loc'. _____________declarative_______ ____________________executable ____________________exception (este optional) +. The declarati,e section contains SQL statements and PL/SQL statements to manipulate data in the data"ase. (True or alse -. The three t&pes of "loc's that can ma'e up a PL/SQL program are (circle answer! a. ". c. d. !nony"ous #rocedures .anipulati,e unctions /racle 0cadem& 1#ata"ase Programming with PL/SQL 1op&right 2 23134 /racle. 0ll rights reser,ed. 5. The following is what t&pe of PL/SQL program6 ___________block_anoni"________ #71L087 ,_date #0T7 !9 S:S#0T7; <7=>* #<.S_/?TP?T.P?T_L>*7(,_date; 7*#; 13. @here are su"programs stored6 ________data base 11. >n the L>A7 operator4 which s&m"ol is used to represent a single teBt character or numeric digit (circle answer6 a. ". c. d. $_ $ C/C CDC CEC asdf(li'e pt mai multe caractere 12. @hich of the following can "e used in the S7L71T statement to return all columns of data in a ta"le (circle answer6 a. ". c. d. 0LL 1olumns % #>ST>*1T 13. The ______distinct____ 'e&word is used to eliminate duplicate rows from the output of a SQL statement. 1$. ________&V'(de ex cantitate())__ is a general function that con,erts a null ,alue to a date4 a character4 or a num"er. 1%. To a,oid a 1artesian product4 if there are four ta"les in the (8/. clause4 what is the minimum Foins that must "e specified (circle answer6 a. ". c. d. one two t*ree four 1). PL/SQL ,aria"les can "e used for (circle answer! a. ". c. d. +eusability 1omments Stored values ,efault values 1+. 0 reser,ed word can "e used as an identifier in a PL/SQL program. (True or alse) /racle 0cadem& 2#ata"ase Programming with PL/SQL 1op&right 2 23134 /racle. 0ll rights reser,ed. 1-. @hich are ,alid declaration statements6 _____ a. ". c. d. ,_first_name !9 GHohnG; ,_date #0T7 !9 T/#0:; age_c *?.<78 (3 I9 2%; count_loop -.&!+/_.&T010+ 23 )4 15. @h& is the following statement in,alid6 ,_,alid <//L70* */T *?LL; ____nu este initiali5ata __________________________________________ 23. Select the correct method for declaring a ,aria"le of a pre,iousl& declared ,aria"le or data"ase column (circle answer. a. EL>A7 ". 6T/#0 c. E1/LT:P7 21. 0J=4 1/?*T4 and S?. are what t&pe of functions6 ______agregare sau de grup______________ 22. 1hoose the statement that will run without error. c__________ a. S7L71T region_id4 1/?*T(countr&_id =8/?P <: region_id treb fro" inainte (8/. wf_countries @K787 region_id L 1%; ". S7L71T region_id4 1/?*T(countr&_id (8/. wf_countries grup by nu se face niciodata dupa count @K787 region_id L 1% =8/?P <: 1/?*T(countr&_id; c. S7L71T region_id4 1/?*T(countr&_id (8/. wf_countries @K787 region_id L 1% =8/?P <: region_id; 23. =roup functions can "e used in su"Mueries. (True or (alse 2$. Su"Mueries must contain onl& one row to the main Muer&. (True or alse) 2%. @hich group functions "elow act on teBt4 num"er and date datat&pes (circle answer6 a. ". c. d. e. S?. 7!8 7.& 0J= C9:&T 3#ata"ase Programming with PL/SQL 1op&right 2 23134 /racle. 0ll rights reser,ed. /racle 0cadem& 2). >n which instances listed "elow is a SQL function allowed in a PL/SQL procedural statement (circle answers6 a. ". c. d. Single;ro< c*aracter ,ate =roup functions sum4 min nu se pot face in PL/SQL ,ata type conversion 2+. 1onsider the following PL/SQL "loc'. @hat occurs for this "loc' to "e ,alid6 #71L087 ,_salar&*?.<78()!9)333; ,_sal_increase J081K082(%!9G1333G; ,_total_salar& ,_salar&ET:P7; <7=>* ,_total_salar&!9 ,_salar& N ,_sal_increase; #<.S_/?TP?T.P?T_L>*7(,_total_salar&; 7*#; _conversia i"plicita (transfor"area caracterului in nu"a) 2-. >ndicate which statements are ,alid (circle answer. a. ". c. d. v_ne<_date ,!T0 23 =)>;?:&;@AA>=4 ,_new_date #0T7 !9 G:esterda&G; v_"y_nu"ber &:7-0+ 23 =@>3=4 ,_m&_num"er *?.<78 !9 G123a"cG; 25. >s the following a ,alid statement6 :es or &o ,_date_of_Foining #0T7!9 G(e"ruar& 3242333G; 33. >s the following a ,alid statement6 /es or *o ,_salar& *?.<78; 31. >s the following a ,alid statement6 /es or *o ,_address J081K082(33; 32. @hat is a leBical unit6 _____(identificatori4cu, reOer,ate comentariile delimitatorii a. ! building block of a #'BSC' block ". 0 t&pe of ,aria"le c. 0 data t&pe for a ,aria"le /racle 0cadem& $#ata"ase Programming with PL/SQL 1op&right 2 23134 /racle. 0ll rights reser,ed. 33. @hich of the following is a composite data t&pe6 _____ a. J081K082(scalare ". +0C9+, c. 1L/<(scalare) 3$. >t is good programming practice to allow implicit data t&pe con,ersions since the& do not affect performance. (True or alse) 3%. The operators in SQL (logical4 arithmetic4 parentheses control4 etc. are the same for PL/SQL. (True or (alse 3). >n PL/SQL4 a ,aria"lePs ____scope______ is the "loc' in which it is declared plus all "loc's nested within the declaring "loc'. 3+. >f PL/SQL does not find the ,aria"le declared locall&4 it loo's upward in the declarati,e section of the parent "loc's. PL/SQL does not loo' downward in the child "loc's. (True or (alse 3-. @hat is the ,alue of the highlighted line of code in this "loc' of code6 ___@> dec >))>_______ #71L087 ,_father_name J081K082(23!9GPatric'G; ,_date_of_"irth #0T7!9G23Q0prQ15+2G; <7=>* #71L087 ,_child_name J081K082(23!9G.i'eG; ,_date_of_"irth #0T7!9G12Q#ecQ2332G; <7=>* #<.S_/?TP?T.P?T_L>*7(G(atherGGs *ame! GRR,_father_name; #<.S_/?TP?T.P?T_L>*7(G#ate of <irth! GRR,_date_of_"irth; #<.S_/?TP?T.P?T_L>*7(G1hildGGs *ame! GRR,_child_name; 7*#; #<.S_/?TP?T.P?T_L>*7(G#ate of <irth! GRR,_date_of_"irth; 7*#; /racle 0cadem& %#ata"ase Programming with PL/SQL 1op&right 2 23134 /racle. 0ll rights reser,ed. 35. @hat ,alues will "e displa&ed when the following code is eBecuted6 ___null_______ ______Day____ #71L087 ,_name J081K082(13; <7=>* ,_name !9 GHa&G; #71L087 ,_name J081K082(13; <7=>* #<.S_/?TP?T.P?T_L>*7 (,_name; ,_name !9 GHa&neG; 7*#; #<.S_/?TP?T.P?T_L>*7 (,_name; 7*#; $3. 0n eBception can "e dealt with in which of the following wa&s (circle answer6 a. Eandling it in t*e block in <*ic* it occurs ". Propogating it to the calling en,ironment c. Eandling it in an outer block in <*ic* it occurs $1. @hat are the two methods for adding comments to PL/SQL code6 __select insert update delete____________________________ ______________________________ $2. @hich of the following statements can &ou use in PL/SQL (circle answer6 S0'0CT to retrieve data fro" t*e database. ,7' state"ents suc* as .&S0+T to "ake c*anges to ro<s in t*e database. ##L statements such as 1870T7 T0<L7 to manage o"Fects in the data"ase. Transaction control state"ents suc* as S!V0#9.&T to control transactional state"ents in the data"ase. e. #1L statements such as 87J/A7 to adFust pri,ileges to the data"ase o"Fects. $3. 1hoose the ,alid statements. _____ a. S0'0CT first_na"e .&T9 v_fna"e +97 e"ployees FE0+0 e"ployee_id3>))4 ". S7L71T first_name >*T/ ,_fname (8/. emplo&ees @K787 emplo&ee_id >* (2334 231; c. S7L71T first_name (8/. emplo&ees >*T/ ,_fname @K787 emplo&ee_id9233; d. S7L71T first_name (8/. emplo&ees >*T/ ,_fname @K787 emplo&ee_id >* (2334 231; a. ". c. d. /racle 0cadem& )#ata"ase Programming with PL/SQL 1op&right 2 23134 /racle. 0ll rights reser,ed. $$. @hat is the uniMue characteristic a"out the returned ,alue of a PL/SQL S7L71T statement6 ______________________________treb sa returne5e un sg rand____________________ $%. @hat are the two most common error messages for a PL/SQL S7L71T statement6 ______returnea5a prea "ulte valori si knd nu returnea5a nici o inregistrare se nu"este no data found____________________________________________ $). @hat would "e the result of the following statement6 _____sterge toate inregistrarile din tabel_____________________________________________ #7L7T7 emplo&ees; $+. To determine how man& rows are affected "& a statement4 use the following implicit cursor attri"ute! _____ a. ". c. d. SQLE(/?*# SQLE*/T(/?*# SC'6+9FC9:&T SQLE1/?*T $-. :ou can use implicit cursor attri"utes such as SQLE8/@1/?*T directl& inside a #.L statement as in the following eBample. (True or alse) >*S78T >*T/ log_ta"le J0L?7S (?S784 S:S#0T74 SQLE8/@1/?*T; $5. To S7L71T more than one row4 &ou must declare and use __cursor i"plicit________________. %3. Transaction control commands are ,alid in PL/SQL and therefore can "e directl& used in the eBecuta"le section onl& of a PL/SQL "loc'. (True or (alse %1. @hat ,alues are inserted into the pairta"le ta"le "ased on this PL/SQL code6 _________G( H ( @3( @I___________ <7=>* >*S78T >*T/ pairta"le J0L?7S (+4 -; S0J7P/>*T m&_sp_1; >*S78T >*T/ pairta"le J0L?7S (54 13; S0J7P/>*T m&_sp_2; >*S78T >*T/ pairta"le J0L?7S (114 12; 8/LL<01A to m&_sp_1; >*S78T >*T/ pairta"le J0L?7S (134 1$; 1/..>T; 7*#; /racle 0cadem& +#ata"ase Programming with PL/SQL 1op&right 2 23134 /racle. 0ll rights reser,ed. *ame the control structures in PL/SQL that change the logical flow of statements (circle answers. a. ". c. d. e. . state"ent 'oop state"ent 8/LL<01A statement .78=7 statement C!S0 state"ent %2. 0n >( statement reMuires an 7LS7 condition. (True or alse %3. 7LS7>( is the 'e&word that introduces a conditional eBpression. (True or alse) %$. Select the ,alid >( statement. __a___ a. #71L087 ,_m&age *?.<78 !931; <7=>* >( ,_m&age L 11 TK7* #<.S_/?TP?T.P?T_L>*7(G > am a child G; 7LS7 #<.S_/?TP?T.P?T_L>*7(G > am not a child G; 7*# >(; 7*#; ". #71L087 ,_m&age *?.<78 !931; <7=>* >( ,_m&age L 11 TK7* #<.S_/?TP?T.P?T_L>*7(G > am a child G; 7LS>( #<.S_/?TP?T.P?T_L>*7(G > am not a child G; 7*# >(; nu are conditie la 0nd. 7*#; c. #71L087 ,_m&age *?.<78 !931; <7=>* >( ,_m&age L 11 TK7* #<.S_/?TP?T.P?T_L>*7(G > am a child G; 7LS7 #<.S_/?TP?T.P?T_L>*7(G > am not a child G; 7*#>(; are 0&,. i"preunat 7*#; %%. @hat is the maBimum num"er of 7LS>( statements &ou can use in an >( conditional statement6 ____nu are "axi"______ /racle 0cadem& -#ata"ase Programming with PL/SQL 1op&right 2 23134 /racle. 0ll rights reser,ed. %). 1hoose the correct statements a"out *?LL ,alues (circle answer. a. Simple comparisons in,ol,ing nulls alwa&s &ield (0LS7. ". .n conditional control state"ents( if a condition yields &:''( it be*aves Dust like a !'S0. c. !pplying t*e logical operator &9T to a null yields &:''. %+. @hat will "e displa&ed when this "loc' is eBecuted6 _____ ____ #71L087 ,_alpha <//L70* !9 T8?7; ,_"eta <//L70*; ,_char J081K08($ !9 GupG; <7=>* >( (,_alpha 0*# ,_"eta TK7* ,_char!9GdownG; 7LS7 ,_char!9GleftG; 7*# >(; #<.S_/?TP?T.P?T_L>*7(,_char; 7*#; !devaratJ null3 null si nu se executa if a. ". c. d. ?p #own 'eft *ull %-. 0 10S7 eBpression is Fust li'e an >( statement "ut with fewer words. (True or alse) %5. 0 10S7 eBpression returns one of a num"er of ,alues into a ,aria"le. (True or (alse )3. Kow do &ou terminate a case statement6 _________end ___________ )1. Select the correct 10S7 eBpression. ___b___ a. ,_appraisal !9 10S7 @K7* ,_grade 9 G0G TK7* G7BcellentG; @K7* ,_grade >* (G<G4 G1G TK7* G=oodG; 7LS7 G*o such gradeG; 7*#; are4 dupa instructiune ". ,_appraisal !9 10S7 @K7* ,_grade 9 G0G TK7* G7BcellentG @K7* ,_grade >* ((G<G4 G1G TK7* G=oodG 7LS7 G*o such gradeG 7*#; /racle 0cadem& 5#ata"ase Programming with PL/SQL 1op&right 2 23134 /racle. 0ll rights reser,ed. c. ,_appraisal !9 10S7 @K7* ,_grade 9 G0G TK7* G7BcellentG @K7* ,_grade >* ((G<G4 G1G TK7* G=oodG 7LS7 G*o such gradeG 7*# 10S7; se ter"ina cu end case si treb sa se ter"ine cu end )2. 0 10S7 statement ma& contain man& PL/SQL statements. (True or (alse )3. @hat is the ,alue for ,_flag in the following eBample6 _______fals___ #71L087 ,_flag <//L70*; ,_reorder_flag <//L70* !9 *?LL; ,_a,aila"le_flag <//L70* !9 (0LS7; <7=>* ,_flag !9 ,_reorder_flag 0*# ,_a,aila"le_flag; 7*#; )$. @hat is the statement reMuired of a "asic loop so that it will not "e infinite6 exit__________ )%. Kow man& times will the statement in the loop "elow eBecute6 @ #71L087 ,_counter *?.<78 !9 1; <7=>* L//P #<.S_/?TP?T.P?T_L>*7(GThe sMuare of GRR,_counterRRG is! GRR P/@78(,_counter42; ,_counter !9 ,_counter N 1; 7S>T @K7* ,_counter L 13; 7*# L//P; 7*#; a. @ ". 3 c. 5 )). @hen will a @K>L7 loop Muit6 ___cat ti"p e adevarata conditia_________________________________________ /racle 0cadem& 13#ata"ase Programming with PL/SQL 1op&right 2 23134 /racle. 0ll rights reser,ed. )+. The ,alue for ,_counter is initialiOed to 1. Kow man& rows will "e inserted into the locations ta"le6 __3___ @K>L7 ,_counter L9 3 L//P >*S78T >*T/ locations (location_id4 cit&4 countr&_id J0L?7S((,_loc_id N ,_counter4 ,_new_cit&4 ,_countr&id; ,_counter !9 ,_counter N 1; 7*# L//P; a. ". c. d. 1 2 3 $ )-. >n a @K>L7 loop4 the controlling condition is chec'ed at the start of each iteration. (True or (alse )5. Kow man& lines of output will "e displa&ed6 __@________ #71L087 i !9 2; <7=>* @K>L7 i L 3 L//P i !9 $; #<.S_/?TP?T.P?T_L>*7(GThe counter is! G RR i; 7*# L//P; 7*#; +3. Kow man& times will the (/8 loop "elow eBecute6 _____@_____ (/8 i in 3..3 L//P statement1; 7*# L//P; /racle 0cadem& 11#ata"ase Programming with PL/SQL 1op&right 2 23134 /racle. 0ll rights reser,ed. +1. @hat is the last message from this eBample6 ______ <7=>* (/8 ,_outerloop in 1..3 L//P (/8 ,_innerloop in 87J78S7 1..% L//P #<.S_/?TP?T.P?T_L>*7(G/uter loop is! GRR,_outerloopRR G and inner loop is! GRR,_innerloop; 7*# L//P; 7*# L//P; 7*#; a. /uter loop is! 3 and inner loop is! % ". /uter loop is! 1 and inner loop is! % c. 9uter loop is2 3 and inner loop is2 @ +2. @hat are the steps for using a cursor6 _____ a. ". c. d. #efine4 select4 close /pen4 fetch4 close ,efine( open( fetc*( close /pen4 select4 fetch4 close +3. The following statement is a ,alid cursor declaration. (True or alse) #71L087 1?8S/8 dept_emp_cursor >S S7L71T department_name4 1/?*T(T 0S how_man& (8/. departments d4 emplo&ees e @K787 d.department_id 9 e.department_id =8/?P <: d.department_name K0J>*= 1/?*T(T U 1; +$. /P7* is an eBecuta"le statement that performs which of the following operations (circle answer6 a. 0xecutes t*e S0'0CT state"ent in t*e cursor declaration( returning t*e results into t*e active set (fills t*e box <it* data) ". ,yna"ically allocates "e"ory for a context area c. 8etrie,es the first row from the cursor. d. #ositions t*e pointer to t*e first ro< in t*e active set. +%. Kow do &ou test to see whether the cursor contains rows6 __cursor cu attribute found sau not found_______________________________________ ____________________________________________________________ /racle 0cadem& 12#ata"ase Programming with PL/SQL 1op&right 2 23134 /racle. 0ll rights reser,ed. +). @hat is wrong with the following code6 __________ 0TCE inainte de 9#0&_________________________________________ #71L087 1?8S/8 emp_curs >S S7L71T last_name4 salar& (8/. emplo&ees; ,_last_name emplo&ees.last_nameET:P7; ,_salar& emplo&ees.salar&ET:P7; <7=>* (7T1K emp_curs >*T/ ,_last_name4 ,_salar&; /P7* emp_curs; (7T1K emp_curs >*T/ ,_last_name4 ,_salar&; 1L/S7 emp_curs; 7*#; ++. 0 cursor ma& "e reopened at an& time. (True or alse) doar daca a fost inc*is +-. The eBample "elow uses what t&pe of composite data t&pe structure6 record definit cu +9FT/#0 #71L087 1?8S/8 emp_cursor >S S7L71T emplo&ee_id4 last_name (8/. emplo&ees @K787 department_id 9 33; ,_emp_record emp_cursorE8/@T:P7; <7=>* /P7* emp_cursor; L//P (7T1K emp_cursor >*T/ ,_emp_record; ... +5. Kow do &ou reference the last_name ,alue inside the loop in the eBample "elow6 _______________ v_e"p_record last na"e_________________________ #71L087 1?8S/8 emp_cursor >S S7L71T emplo&ee_id4 last_name (8/. emplo&ees @K787 department_id 9 33; ,_emp_record emp_cursorE8/@T:P7; <7=>* /P7* emp_cursor; L//P (7T1K emp_cursor >*T/ ,_emp_record; ... /racle 0cadem& 13#ata"ase Programming with PL/SQL 1op&right 2 23134 /racle. 0ll rights reser,ed. -3. @hich are the cursor attri"utes that return useful information a"out the eBecution of a cursor manipulation statement (circle answer6 a. ". c. d. e. E/P7* 69:&, 6&9T9:&, E8/@T:P7 6+9FC9:&T -1. @hat t&pe of loop performs the following actions! The cursor is opened4 a row is fetched once for each iteration in the loop4 the loop is terminated automaticall& when the last row is processed4 and the cursor is closed automaticall&. _ cursor for loop_________________________________________________ -2. To displa& the last name of an emplo&ee4 what code should &ou write at Point 0 in the eBample "elow6 __e"p _record. 'ast_ na"e____________________________ #71L087 1?8S/8 emp_cursor >S S7L71T T (8/. emplo&ees; <7=>* (/8 emp_record >* emp_cursor L//P #<.S_/?TP?T.P?T_L>*7( QQPoint 0 QQ ; 7*# L//P; 7*#; -3. Select the correct method for opening the cursor in the eBample "elow (circle answer. 1?8S/8 emp_curs (p_dept_id emplo&ees.department_idET:P74 p_Fo"_id emplo&ees.Fo"_idET:P7 >S S7L71T T (8/. emplo&ees @K787 department_id 9 p_dept_id 0*# Fo"_id 9 p_Fo"_id; a. ". c. d. /P7* emp_curs (23; (/8 emp_rec >* emp_curs (23 L//P /P7* emp_curs (G>T_P8/=G4 23; 9+ e"p_rec .& e"p_curs (>)( =.T_#+91=) '99# -$. >s this a ,alid cursor declaration6 (:es or &o 1?8S/8 dept_curs (p_loc_id *?.<78($ >S S7L71T T (8/. departments @K787 location_id 9 p_loc_id; -%. @hat is the main purpose of the (/8 ?P#0T7 clause in a cursor declaration6 ___sa bloc*e5e inregistrarile tabelei_______________________________________________ /racle 0cadem& 1$#ata"ase Programming with PL/SQL 1op&right 2 23134 /racle. 0ll rights reser,ed. -). >n which #.L statements would &ou use the @K7* 1?887*T /( clause6 ___insert update delete_______________________________________________ -+. :ou want to fetch rows from the 7.PL/:77S ta"le. :ou want to loc' the fetched rows4 to pre,ent other users from updating them. @hat would &ou write in Line 06 1?8S/8 emp_curs >S S7L71T department_name4 emplo&ee_id4 last_name4 salar& (8/. emplo&ees e4 departments d @K787 e.department_id 9 d.department_id QQ Line 0 QQ ; a. (/8 ?P#0T7 ". 9+ :#,!T0 9 e"ployee_id c. (/8 ?P#0T7 /( departments --. :ou ha,e declared a cursor as S7L71T .... (/8 ?P#0T7; :ou ha,e /P7*ed the cursor and loc'ed the (7T1Ked rows. @hen are these row loc's released6 __cand se inc*ide cursorul dar si cand se face rool back ________________________________________________ -5. @hat would &ou enter at Line 06 __________ #71L087 1?8S/8 region_cur >S S7L71T T (8/. regions; ,_region_rec region_curE8/@T:P7; 1?8S/8 countr&_cur (p_region_id *?.<78 >S S7L71T T (8/. countries @K787 region_id 9 p_region_id; ,_countr&_rec countr&_curE8/@T:P7; <7=>* /P7* region_cur; L//P (7T1K region_cur >*T/ ,_region_rec; 7S>T @K7* region_curE*/T(/?*#; #<.S_/?TP?T.P?T_L>*7 (,_region_rec.region_name; QQ Line 0 QQ L//P (7T1K countr&_cur >*T/ ,_countr&_rec; 7S>T @K7* countr&_curE*/T(/?*#; ...... a. ". c. d. /P7* countr&_cur (p_region_id; /P7* countr&_cur (region_cur.region_id; /P7* countr&_cur (region_cur.region_id; 9#0& country_cur (v_region_rec.region_id)4 1%#ata"ase Programming with PL/SQL 1op&right 2 23134 /racle. 0ll rights reser,ed. /racle 0cadem& 53. :ou cannot use a (/8 loop with multiple cursors. (True or (alse /racle 0cadem& 1)#ata"ase Programming with PL/SQL 1op&right 2 23134 /racle. 0ll rights reser,ed.