Welcome to Scribd, the world's digital library. Read, publish, and share books and documents. See more ➡
Download
Standard view
Full view
of .
Add note
Save to My Library
Sync to mobile
Look up keyword
Like this
16Activity
×
0 of .
Results for:
No results containing your search query
P. 1
quiz s9

quiz s9

Ratings: (0)|Views: 3,173|Likes:
Published by a23mer1439

More info:

Published by: a23mer1439 on Apr 26, 2011
Copyright:Attribution Non-commercial

Availability:

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

05/27/2013

pdf

text

original

 
SECTION 9
LESSON 1
1. What will happen when the following subprogram is compiled?PROCEDURE at_proc ISPRAGMA AUTONOMOUS_TRANSACTION;dept_id NUMBER := 90;BEGINUPDATE ...INSERT ...END at_proc;Mark for Review(1) PointsThe subprogram will fail because it is missing AUTHID CURRENT_USER before IS.The autonomous transaction subprogram will fail because it must include COMMIT or ROLLBACK. (*)The compilation will fail because a semicolon after AUTONOMOUS_TRANSACTION is not needed.The program will compile successfully.Incorrect. Refer to Section 9 Lesson 6.2. To create a function successfully, the following steps should be performed:A Re-execute the code until it compiles correctlyB Write the code containing the CREATE or REPLACE FUNCTION followed by the function codeC Test the function from a SQL statement or an anonymous block D If the function fails to compile, correct the errorsE Load the code into Application ExpressF Execute the code in Application ExpressWhat is the correct order to perform these steps?Mark for Review(1) PointsB,E,F,D,A,C (*)D,B,E,F,A,CB,C,E,F,D,AA,B,E,F,D,CCorrect3. An autonomous transaction subprogram may be in the same package as the calling subprogram or may be in a separate subprogram. True or False? Mark for Review(1) PointsTrueFalse (*)Incorrect. Refer to Section 9 Lesson 6.
 
4. Which of the following is found in a function and not a procedure? Mark for Review(1) PointsAn exception section.IN parameters.Local variables in the IS/AS section.Return statement in the header. (*)Correct5. The following function has been created:CREATE OR REPLACE FUNCTION find_sal(p_emp_id IN employees.employee_id%TYPE)RETURN NUMBER IS ...We want to invoke this function from the following anonymous block:DECLAREv_mynum NUMBER(6,2);v_mydate DATE;BEGIN... Line AEND;Which of the following would you include at Line A?Mark for Review(1) Pointsfind_sal(100,v_mynum);v_mynum := find_sal(100); (*)v_mydate := find_sal(100);find_sal(v_mynum,100);Correct6. You have created a function called GET_COUNTRY_NAME which accepts a country_id as an IN parameter and returns the name of the country. Which one of the following calls to the function will NOTwork? Mark for Review(1) Pointsv_name := get_country_name(100);DBMS_OUTPUT.PUT_LINE(get_country_name(100));SELECT get_country_name(100) FROM dual;BEGIN get_country_name(100, v_name); END; (*)Correct7. What is wrong with the following code? CREATE FUNCTION annual_comp (sal employees.salary%TYPE, comm_pct IN employees.commission%TYPE) RETURN NUMBER(5,2) IS RETURN (sal*12) + NVL(comm_pct,0)*12*sal; END annual_comp; Mark for Review(1) Points
 
The sal parameter should specify the IN keyword.The RETURN NUMBER has a scale and precision. (*)There should be parentheses (brackets) around NVL(comm_pct,0)*12*salThe END; statement should not include the function name.Correct8. Function MYFUNC1 has been created, but has failed to compile because it contains syntax errors.We now try to create procedure MYPROC1 which invokes this function. Which of the following statements istrue? Mark for Review(1) PointsMYPROC1 will compile correctly, but will fail when it is executed.MYPROC1 will compile and execute succesfully.MYPROC1 will fail to compile because the function is invalid. (*)MYPROC1 will compile and execute successfully, except that the call to MYFUNC1 will be treated as acomment and ignored.Correct9. Based on the following function definition: Create function annual_comp (sal employees.salary%type, comm_pct In employees.commission%type) ... Which one of the following is an incorrect call for annual_comp?
 
Mark for Review(1) PointsExecute dbms_output.put_line(annual_comp (1000,.2))Select employee_id, annual_comp(salary, commission_pct) from employees;Declare Ann_comp number (6,2); Begin ... Ann_comp := annual_comp(1000,.2); ... End;Select employee_id, annual_comp(salary) from employees; (*)Correct10. When using Invoker's rights, the invoker needs privileges on the database objects referenced withinthe subprogram, as well as GRANT privilege on the procedure. True or False? Mark for Review(1) PointsTrueFalse (*)Incorrect. Refer to Section 9 Lesson 6.11. Procedure p1 has a single OUT parameter of type DATE. Function f1 returns a DATE. What is thedifference between p1 and f1? Mark for Review(1) Points p1 can be invoked from an anonymous block but f1 cannotf1 can be used within a SQL statement but p1 cannot (*) p1 can have as many IN parameters as needed but f1 cannot have more than two IN parametersThere is no difference because they both return a single value of the same datatypeIncorrect. Refer to Section 9 Lesson 1.12. A PL/SQL function can have IN OUT parameters. True or False? Mark for Review(1) Points

Activity (16)

You've already reviewed this. Edit your review.
1 hundred reads
1 thousand reads
Enis Gemil liked this
draufy liked this
Simona Sym liked this
Andreea Tirnacop liked this
adnanamaria liked this
Petenchia Marius liked this
Nicholas Fu liked this

You're Reading a Free Preview

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