PLSQL
PLSQL
1.
Which package construct must be declared and defined within the package body?
2.
3.
You have been granted the necessary privilege to invoke a function created by another developer. You are
having problems calling this function from your procedure & want to contact the developer who created the
function. Which table would you query to determine the owner of this function?
4.
USER_OBJECTS
ALL_FUNCTIONS
ALL_OBJECTS (Answer)
USER_FUNCTION_CODE
-1-
5.
The outside procedure and the package body are invalidated. (Answer)
Only the standalone procedure is invalidated.
Only the package body is invalidated.
There will be no effect.
6.
PACKAGE BODY
DATABASE TRIGGER
PACKAGE SPECIFICATION (Answer)
each procedure's DECLARE section
-2-
7.
8.
USER_PROCEDURES
USER_PROCS
USER_OBJECTS (Answer)
USER_PLSQL_UNITS
9.
Which statement best describes the difference between auditing objects with triggers and auditing objects
within the server?
-3-
What will
The outside procedure and the package body are invalidated. (Answer)
Only the standalone procedure is invalidated.
Only the package body is invalidated.
There will be no effect.
12. One of your procedures must create a table during execution. Which Oracle supplied package must you use
to accomplish this task?
DBMS_CREATE_OBJECT
DBMS_SQL (Answer)
DBMS_PIPE
DBMS_TRANSACTION
EXECUTE TEAM_TAX(1)
VARIABLE G_TEAM_TAX_AMNT NUMBER
EXECUTE :G_TEAM_TAX_AMNT := TEAM_TAX(1)
RUN TEAM_TAX(1)
SELECT NAME, TEAM_TAX(ID)
FROM TEAM
WHERE TEAM_TAX(ID) > 300000;
TEAM_TAX(ID);
-4-
PACKAGE SPECIFICATION
DECLARE SECTION of the first procedure declared in the package.
PACKAGE BODY (Answer)
PACKAGE EXCEPTION
-5-
16. Your can enter new ballplayers to the PLAYER table from different Oracle Forms applications and from an
application written in C. For each new ballplayer, a record must be inserted into the PLAYER_BAT_STAT
table. Which action should you perform to accomplish this requirement?
17. Which table and column can you query to see all procedures and functions that have been marked invalid?
18. Your procedure references a function created by another application developer. You need to contact this
person to discuss the code contained in the function. Which table can you query to determine the owner of
this function?
USER_DEPENDENCIES (Answer)
USER_REFERENCES
USER_CONSTRAINTS
USER_LINKS
19. The ADD_PLAYER procedure executes the UPD_PLAYER_STAT procedure. The UPD_PLAYER_STAT
procedure updates the PLAYER_BAT_STAT table. SCOTT owns all objects. Which statement will find this
indirect dependency between the ADD_PLAYER procedure and the PLAYER_BAT_STAT table?
20. The ADD_PLAYER procedure executes the UPD_PLAYER_STAT procedure. The UPD_PLAYER_STAT
procedure updates the HITS column of the PLAYER_BAT_STAT table. What will happen if the HITS column of
the PLAYER_BAT_STAT table is modified from NUMBER(3) TO NUMBER(4)?
Both the ADD_PLAYER and UPD_PLAYER_STAT procedures are marked invalid. (Answer)
The ADD_PLAYER procedure is marked invalid.
The UPD_PLAYER_STAT procedure is marked invalid.
Neither procedure is marked invalid.
-6-
STATS_EXIST_EXCEPTION NUMBER;
PRAGMA EXCEPTION_INIT(STATS_EXISTS_EXCEPTION, -2292);
STATS_EXIST_EXCEPTION EXCEPTION;
PRAGMA EXCEPTION_INIT(-2292, STATS_EXISTS_EXCEPTION);
STATS_EXIST_EXCEPTION EXCEPTION;
PRAGMA EXCEPTION_INIT(STATS_EXISTS_EXCEPTION, -2292);
STATS_EXIST_EXCEPTION EXCEPTION;
PRAGMA EXCEPTION_INIT(STATS_EXISTS_EXCEPTION, 2292);
23. Which statement will successfully create the procedure ADD_PLAYER in SQL* Plus?
(Answer)
CREATE OR REPLACE PROCEDURE ADD_PLAYER
(V_ID IN NUMBER, V_LAST_NAME VARCHAR2)
IS
BEGIN
INSERT INTO PLAYER (ID,LAST_NAME) VALUES (V_ID, V_LAST_NAME);
COMMIT;
END;
-7-
-8-
Procedures and functions are re-parsed for multiple users by exploiting shared SQL areas.
Procedures and functions avoid re-parsing for multiple users by exploiting shared SQL areas. (Answer)
Procedures and functions increase the number of calls to the database.
Testing of procedures and functions requires the database to be restarted to clear out shared SQL areas for
future access.
28. Which statement must be added to make this trigger execute after updating the SALARY column of the
PLAYER table?
AFTER UPDATE (SALARY) ON PLAYER
AFTER SALARY UPDATE OF PLAYER
AFTER UPDATE ON PLAYER
AFTER UPDATE OF SALARY ON PLAYER (Answer)
29. Examine this function:
CREATE OR REPLACE FUNCTION CALC_PLAYER_AVG
(V_ID IN NUMBER)
RETURN NUMBER
-9-
31. The ADD_PLAYER procedure residing in your local database in Austin executes the UPD_PLAYER_STAT
procedure residing in Chicago. The procedure in Chicago has just been changed and recompiled.
What will happen?
An error will occur next time the ADD_PLAYER procedure is executed. (Answer)
There will be no effect if the UPD_PLAYER_STAT procedure compiled successfully.
The ADD_PLAYER procedure will automatically recompile the next time you invoke it.
An error will occur next time the UPD_PLAYER_STAT procedure is executed.
EXECUTE CALC_PLAYER_AVG(31);
- 10 -
SELECT CALC_PLAYER_AVG(31)
FROM PLAYER_BAT_STAT;
VARIABLE G_AVG NUMBER
EXECUTE :G_AVG := CALC_PLAYER_AVG(31);
CALC_PLAYER_AVG(31);
START CALC_PLAYER_AVG(31);
34. For every new ballplayer added to the PLAYER table, a record must be inserted into the PLAYER_BAT_STAT
table. You have written a trigger to accomplish this task.
To which timing will this trigger be assigned?
STATEMENT
PRE-INSERT
AFTER (Answer)
BEFORE
35. The ADD_PLAYER, UPD_PLAYER_STAT and UPD_PITCHER_STAT procedures are executed frequently
together from different applications. What steps should be performed to logically group these procedures
together in order to increase performance?
Create a SQL* Plus script file that contains each procedure's CREATE statement
Create a package specification. Place the name of each procedure in the new specification.
Create a package specification and body with the source code of each procedure. Keep the stand-alone
procedures for the specification to reference.
Create a package specification and body with the source code of each procedure. Drop the old stand-alone
procedures. (Answer)
36. The ADD_PLAYER procedure calls the UPD_PLAYER_STAT procedure. Both procedures are INVALID.
Which command can you issue to recompile both procedures?
- 11 -
EXECUTE UPD_BAT_STAT
EXECUTE UPD_BAT_STAT(31)
EXECUTE UPD_BAT_STAT(31,'FOUR','TWO')
EXECUTE UPD_BAT_STAT(V_AB => 4, V_ID => 31, V_HITS => 2)
EXECUTE UPD_BAT_STAT(31,4,2)
39. The ADD_PLAYER procedure must calculate the amount of social security tax that the team needs to pay. This
algorithm is already written in a C program. You decide to call this program from the ADD_PLAYER procedure.
Which Oracle Procedure Builder built-in package must you use to accomplish this task?
ORA_PROF
ORA_FFI (Answer)
TOOL_ENV
STPROC
This is a statement level trigger and therefore cannot reference :new. (Answer)
This is a row level trigger and therefore cannot reference :new.
This is a statement level trigger and therefore cannot perform data manipulation statements.
This is a row level trigger and therefore cannot perform data manipulation statements.
41. Using the debugger in Procedure Builder, which action must you take to temporarily halt the execution of a
procedure?
- 12 -