Welcome to Scribd. Sign in or start your free trial to enjoy unlimited e-books, audiobooks & documents.Find out more
Download
Standard view
Full view
of .
Look up keyword
Like this
15Activity
0 of .
Results for:
No results containing your search query
P. 1
Section 9 Plsql

Section 9 Plsql

Ratings: (0)|Views: 842|Likes:
Published by jane027

More info:

Published by: jane027 on Jun 03, 2010
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

 
1. What is wrong with the following code? CREATE FUNCTION annual_comp (salemployees.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) PointsThe 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.Correct2. 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 includeCOMMIT or ROLLBACK. (*)The compilation will fail because a semicolon after AUTONOMOUS_TRANSACTION is not needed.The program will compile successfully.Correct3. Function MYFUNC1 has been created, but has failed to compile because it contains syntax errors. We now try to create procedure MYPROC1which invokes this function. Which of the following statements is true?Mark forReview(1) Points
 
MYPROC1 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 a comment and ignored.Incorrect. Refer to Section 9 Lesson 1.4. CREATE FUNCTION get_sal(p_id employees.employee_id%TYPE))RETURN numberISv_sal employees.salary%TYPE := 0;BEGINSELECT salary INTO v_salFROM employeesWHERE employee_id = p_id;RETURN v_sal;END get_sal;Which variable is passed to the function and which variable is returned from thefunction?Mark for Review(1) PointsGET_SAL is passed and V_SAL is returned.SALARY is passed and P_ID is returned.EMPLOYEE_ID is passed and SALARY is returned.P_ID is passed and V_SAL is returned. (*)Incorrect. Refer to Section 9 Lesson 1.5. Procedure p1 has a single OUT parameter of type DATE. Function f1 returns a DATE. What is the difference between p1 and f1?Mark forReview(1) Pointsp1 can be invoked from an anonymous block but f1 cannot
 
f1 can be used within a SQL statement but p1 cannot (*)p1 can have as many IN parameters as needed but f1 cannot have more thantwo IN parametersThere is no difference because they both return a single value of the same datatypeIncorrect. Refer to Section 9 Lesson 1.6. Which of the following is found in a function and not aprocedure?Mark for Review(1) PointsAn exception section.IN parameters.Local variables in the IS/AS section.Return statement in the header. (*)Incorrect. Refer to Section 9 Lesson 1.7. A stored function:Mark for Review(1) Pointsmust have at least one IN parameter.cannot be called in a SQL statement.must return one and only one value. (*)is called as a standalone executable statement.Incorrect. Refer to Section 9 Lesson 1.8. An autonomous transaction subprogram may be in the samepackage as the calling subprogram or may be in a separate subprogram. True or False?Mark for Review

Activity (15)

You've already reviewed this. Edit your review.
1 hundred reads
1 thousand reads
Enis Gemil liked this
adnanamaria liked this
Nadira Đogić liked this
Nicholas Fu liked this
Souhaib Bousoura liked this
Jodie Chan liked this
Serban Sergiu liked this
Tcrc Nguyen 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)//-->