1. Examine this procedure:
CREATE
OR REPLACE PROCEDURE DELETE_PLAYER(V_ID IN NUMBER)
IS
BEGIN
DELETE FROM PLAYER
WHERE ID = V_ID
EXCEPTION
WHEN STATS_EXITS_EXCEPTION THEN
DBMS_OUTPUT.PUT_LINE(Cannotdeletethisplayer,
childrecordsexistin PLAYER_BAT_STAT table);
END;
What
prevents this procedure from being created successfully?
A. A comma has
been left after the STATS_EXIST_EXCEPTION exception.
B. The
STATS_EXIST_EXCEPTION has not been declared as a number.
C. The
STATS_EXIST_EXCEPTION has not been declared as an exception.
D. Only
predefined exceptions are allowed in the EXCEPTION section.
2. Under
which two circumstances do you design database triggers? (Choose two)
A. To duplicate
the functionality of other triggers.
B. To replicate
built-in constraints in the Oracle server such as primary key and foreign key.
C. To guarantee
that when a specific operation is performed, related actions are performed.
D. For
centralized, global operations that should be fired for the triggering statement,
regardless of which user or application issues the statement.
3. Local
procedure A calls remote procedure B. Procedure B was compiled at 8 A.M.
Procedure
A was
modified and recompiled at 9 A.M. Remote procedure B was later modified and
recompiled
at 11 A.M. The dependency mode is set to TI MESTAMP. What happens when
procedure A
is invoked at 1 P.M?
A. There is no
affect on procedure A and it runs successfully.
B. Procedure B
is invalidated and recompiles when invoked.
C. Procedure A
is invalidated and recompiles for the first time it is invoked.
D. Procedure A
is invalidated and recompiles for the second time it is invoked.
4. What is a
condition predicate in a DML trigger?
A. A
conditional predicate allows you to specify a WHEN-LOGGING-ON condition in the
trigger body.
B. A
conditional predicate means you use the NEW and OLD qualifiers in the trigger
body as a condition.
C. A
conditional predicate allows you to combine several DML triggering events into
one in the trigger body.
D. A
conditional predicate allows you to specify a SHUTDOWN or STARTUP condition in
the trigger body.
5. This
statement fails when executed:
CREATE OR
REPLACE TRIGGER CALC_TEAM_AVG
AFTER INSERT
ON PLAYER
BEGIN
INSERT INTO
PLAYER_BATSTAT (PLAYER_ID, SEASON_YEAR, AT_BATS, HI TS)
VALUES
(:NEW.ID, 1997, 0, 0) ;
END;
To which
type must you convert the trigger to correct the error?
A. Row
B. Statement
C. ORACLE FORM
trigger
D. Before
6. An
internal LOB is _____.
A. A table.
B. A column
that is a primary key.
C. Stored in
the database.
D. A file
stored outside of the database, with an internal pointer to it from a database
column.
7. You need
to disable all triggers on the EMPLOYEES table. Which command accomplishes this?
A. None of
these commands; you cannot disable multiple triggers on a table in one command.
B. ALTER
TRIGGERS ON TABLE employees DISABLE;
C. ALTER
employees DISABLE ALL TRIGGERS;
D. ALTER TABLE
employees DISABLE ALL TRIGGERS;
8. You have
a row level BEFORE UPDATE trigger on the EMP table. This trigger contains a SELECT
statement on the EMP table to ensure that the new salary value falls within the
minimum and maximum salary for a given job title. What happens when you try to
update a salary value in the EMP table?
A. The trigger
fires successfully.
B. The trigger
fails because it needs to be a row level AFTER UPDATE trigger.
C. The trigger
fails because a SELECT statement on the table being updated is not allowed.
D. The trigger
fails because you cannot use the minimum and maximum functions in a BEFORE UPDATE
trigger.
9. You need
to implement a virtual private database (vpd). In order to have the vpd functionality,
a trigger is required to fire when every user initiates a session in the
database. What type of trigger needs to be created?
A. DML trigger
B. System event
trigger
C. INSTEAD OF
trigger
D. Application
trigger
10. Which
two program declarations are correct for a stored program unit? (Choose two)
A. CREATE OR
REPLACE FUNCTION tax_amt (p_id NUMBER) RETURN NUMBER
B. CREATE OR
REPLACE PROCEDURE tax_amt (p_id NUMBER) RETURN NUMBER
C. CREATE OR
REPLACE PROCEDURE tax_amt (p_id NUMBER, p_amount OUT NUMBER)
D. CREATE OR
REPLACE FUNCTION tax_amt (p_id NUMBER) RETURN NUMBER(10,2)
E. CREATE OR
REPLACE PROCEDURE tax_amt (p_id NUMBER, p_amount OUT NUMBER(10, 2))
11. The
creation of which four database objects will cause a DDL trigger to fire?
(Choose four)
A. Index
B. Cluster
C. Package
D Function
E. Synonyms
F. Dimensions
G. Database
links.4
12. Examine
this code:
CREATE OR
REPLACE PROCEDURE insert_dept (p_location_id NUMBER)
IS
v_dept_id
NUMBER(4);
BEGIN
INSERT INTO
departments
VALUES (5, .Education.,
150, p_location_id);
SELECT
department_id INTO v_dept_id FROM employees WHERE employee_id=99999;
END
insert_dept; /
CREATE OR
REPLACE PROCEDURE insert_location ( p_location_id NUMBER, p_city
VARCHAR2)
IS BEGIN
INSERT INTO
locations(location_id, city)
VALUES
(p_location_id, p_city);
insert_dept(p_location_id);
END
insert_location; /
You just
created the departments, the locations, and the employees table. You did not
insert any
rows. Next
you created both procedures. You new invoke the insert_location procedure using
the
following command: EXECUTE insert_location (19, .San Francisco .) What is the
result in
this EXECUTE
command?
A. The
locations, departments, and employees tables are empty.
B. The
departments table has one row. The locations and the employees tables are
empty.
C. The location
table has one row. The departments and the employees tables are empty.
D. The
locations table and the departments table both have one row. The employees
table is empty.
13. What is
true about stored procedures?
A. A stored
procedure uses the DELCLARE keyword in the procedure specification to declare
formal parameters.
B. A stored
procedure is named PL/SQL block with at least one parameter declaration in the
procedure specification.
C. A stored
procedure must have at least one executable statement in the procedure body.
D. A stored
procedure uses the DECLARE keyword in the procedure body to declare formal parameters.
14. Examine
the trigger:
CREATE OR
REPLACE TRIGGER Emp_count
AFTER DELETE
ON Emp_tab
FOR EACH ROW
DELCARE n
INTEGER;
BEGIN
SELECT COUNT
(*)
INTO n
FROM
Emp_tab;
DMBS_OUTPUT.PUT_LINE
(‘There are now’ ||n || ‘ employees’);
END;
This trigger
results in an error after this SQL statement is entered: DELETE FROM Emp_tab
WHERE Empno
= 7499;
How do you
correct the error?
A. Change the
trigger type to a BEFORE DELETE.
B. Take out the
COUNT function because it is not allowed in a trigger.
C. Remove the
DBMS_OUTPUT statement because it is not allowed in a trigger.
D. Change the
trigger to a statement-level trigger by removing FOR EACH ROW.
15. The OLD
and NEW qualifiers can be used in which type of trigger?
A. Row level
DML trigger
B. Row level
system trigger
C. Statement
level DML trigger
D. Row level
application trigger
E. Statement
level system trigger
F. Statement
level application trigger
16. Which
view displays indirect dependencies, indenting each dependency?
A. DEPTREE
B. IDEPTREE
C. INDENT_TREE
D. I_DEPT_TREE
17. Examine
this code:
CREATE OR
REPLACE PROCEDURE audit_action (p_who VARCHAR2)
AS
BEGIN
INSERT INTO
audit(schema_user)
VALUES(p_who);
END
audit_action; /
CREATE OR
REPLACE TRIGGER watch_it
AFTER LOGON
ON DATABASE CALL audit_action(ora_login_user) /
What does this
trigger do?
A. The trigger
records an audit trail when a user makes changes to the database.
B. The trigger
marks the user as logged on to the database before an audit statement is
issued.
C. The trigger
invoked the procedure audit_action each time a user logs on to his/her schema
and adds the username to the audit table.
D. The trigger
invokes the procedure audit_action each time a user logs on to the database and
adds the username to the audit table.
18. Examine
this procedure:
CREATE OR
REPLACE PROCEDURE UPD_BAT_STAT (V_ID IN NUMBER DEFAULT 10,
V_AB IN
NUMBER DEFAULT 4) IS
BEGIN
UPDATE
PLAYER_BAT_STAT
SET AT_BATS
= AT_BATS + V_AB
WHERE
PLAYER_ID = V_ID;
COMMIT;
END;
Which two
statements will successfully invoke this procedure in SQL *Plus? (Choose two)
A. EXECUTE
UPD_BAT_STAT;
B. EXECUTE
UPD_BAT_STAT(V_AB=>10, V_ID=>31);
C. EXECUTE
UPD_BAT_STAT(31, 'FOUR', 'TWO');
D.
UPD_BAT_STAT(V_AB=>10, V_ID=>31);
E. RUN
UPD_BAT_STAT;
19. Examine
this code:
CREATE OR
REPLACE FUNCTION gen_email_name (p_first_name VARCHAR2, p_last_name VARCHAR2,
p_id NUMBER) RETURN VARCHAR2
IS
v_email_name
VARCHAR2(19);
BEGIN
v_email_name
:= SUBSTR(p_first_name, 1, 1) || SUBSTR(p_last_name, 1, 7) || '@oracle.com’ ;
UPDATE
employees
SET email = v_email_name
WHERE
employee_id = p_id;
RETURN v_email_name;
END;
Which
statement removes the function?
A. DROP
gen_email_name;
B. REMOVE
gen_email_name;
C. DELETE
gen_email_name;
D. DROP
FUNCTION gen_email_name;
20. Examine
this code:
CREATE OR
REPLACE PACKAGE comm_package IS
g_comm
NUMBER := 10;
PROCEDURE
reset_comm(p_comm IN NUMBER);
END
comm_package; /
User Jones
executes the following code at 9:01am:
EXECUTE
comm_package.g_comm := 15
User Smith
executes the following code at 9:05am:
EXECUTE
comm_paclage.g_comm := 20 Which statement is true?
A. g_comm has a
value of 15 at 9:06am for Smith.
B. g_comm has a
value of 15 at 9:06am for Jones.
C. g_comm has a
value of 20 at 9:06am for both Jones and Smith.
D. g_comm has a
value of 15 at 9:03 am for both Jones and Smith.
E. g_comm has a
value of 10 at 9:06am for both Jones and Smith.
F. g_comm has a
value of 10 at 9:03am for both Jones and Smith
21. Examine
this package:
CREATE OR
REPLACE PACKAGE BB_PACK
IS
V_MAX_TEAM_SALARY NUMBER(12,2);
PROCEDURE
ADD_PLAYER(V_ID IN NUMBER, V_LAST_NAME VARCHAR2, V_SALARY NUMBER);
END BB_PACK;
/
CREATE OR
REPLACE PACKAGE BODY BB_PACK IS
V_PLAYER_AVG
NUMBER(4,3);
PROCEDURE
UPD_PLAYER_STAT V_ID IN NUMBER, V_AB IN NUMBER DEFAULT 4,
V_HITS IN
NUMBER) IS
BEGIN
UPDATE PLAYER_BAT_STAT
SET AT_BATS = AT_BATS + V_AB, HITS = HITS
+V_HITS
WHERE PLAYER_ID = V_ID;
COMMIT;
VALIDATE_PLAYER_STAT(V_ID);
END
UPD_PLAYER_STAT;
PROCEDURE
ADD_PLAYER (V_ID IN NUMBER, V_LAST_NAME VARCHAR2,
V_SALARY
NUMBER) IS
BEGIN INSERT
INTO PLAYER(ID,LAST_NAME,SALARY) VALUES (V_ID,
V_LAST_NAME,
V_SALARY); UPD_PLAYER_STAT(V_ID,0,0);
END
ADD_PLAYER;
END BB_PACK
/
Which
statement will successfully assign .333 to the V_PLAYER_AVG variable from a
procedure
outside the package?
A. V_PLAYER_AVG
:= .333;.7
B.
BB_PACK.UPD_PLAYER_STAT.V_PLAYER_AVG := .333;
C.
BB_PACK.V_PLAYER_AVG := .333;
D. This
variable cannot be assigned a value from outside of the package.
22. What can
you do with the DBMS_LOB package?
A. Use the
DBMS_LOB.WRITE procedure to write data to a BFILE.
B. Use the
DBMS_LOB.BFILENAME function to locate an external BFILE.
C. Use the
DBMS_LOB.FILEEXISTS function to find the location of a BFILE.
D. Use the
DBMS_LOB.FILECLOSE procedure to close the file being accessed.
23. Examine
this package:
CREATE OR
REPLACE PACKAGE manage_emps
IS
tax_rate
CONSTANT NUMBER(5,2) := .28;
v_id NUMBER;
PROCEDURE
insert_emp (p_deptno NUMBER, p_sal NUMBER);
PROCEDURE
delete_emp; PROCEDURE update_emp;
FUNCTION
calc_tax (p_sal NUMBER) RETURN NUMBER;
END
manage_emps; /
CREATE OR
REPLACE PACKAGE BODY manage_emps IS
PROCEDURE
update_sal (p_raise_amt NUMBER)
IS
BEGIN
UPDATE emp
SET sal = (sal * p_raise_emt) + sal
WHERE empno
= v_id;
END;
PROCEDURE
insert_emp (p_deptno NUMBER, p_sal NUMBER)
IS
BEGIN
INSERT INTO
emp(empno, deptno, sal)
VALUES(v_id,
p_depntno, p_sal);
END
insert_emp;
PROCEDURE
delete_emp
IS
BEGIN
DELETE FROM
emp
WHERE empno
= v_id;
END
delete_emp;
PROCEDURE
update_emp IS
v_sal NUMBER(10, 2);
v_raise NUMBER(10, 2);
BEGIN
SELECT sal
INTO v_sal
FROM emp
WHERE empno
= v_id;
IF v_sal
< 500 THEN
v_raise
:= .05;
ELSIF v_sal
< 1000 THEN
v_raise
:= .07;
ELSE v_raise
:= .04;
END IF;
update_sal(v_raise);
END
update_emp;
FUNCTION
calc_tax (p_sal NUMBER) RETURN NUMBER IS
BEGIN RETURN
p_sal * tax_rate;
END
calc_tax;
END
manage_emps; /
What is the
name of the private procedure in this package?
A. CALC_TAX
B. INSERT_EMP
C. UPDATE_SAL
D. DELETE_EMP
E. UPDATE_EMP
F. MANAGE_EMPS
24. Which
two dopes the INSTEAD OF clause in a trigger identify? (Choose two)
A. The view
associated with the trigger.
B. The table
associated with the trigger.
C. The event
associated with the trigger.
D. The package
associated with the trigger.
E. The
statement level or for each row association to the trigger.
25. Which
three are valid ways to minimize dependency failure? (Choose three)
A. Querying
with the SELECT * notification.
B. Declaring
variables with the %TYPE attribute.
C. Specifying
schema names when referencing objects.
D. Declaring
records by using the %ROWTYPE attribute.
E. Specifying
package.procedure notation while executing procedures.
26. Examine
this code:
CREATE OR REPLACE PROCEDURE add_dept ( p_name departments.department_name%TYPE
DEFAULT ‘unknown’, p_loc departments.location_id%TYPE DEFAULT 1700)
IS
BEGIN
INSERT INTO departments
(department_id, department_name, loclation_id)
VALUES (dept_seq.NEXTVAL,p_name,
p_loc);
END
add_dept; /
You created
the add_dept procedure above, and you now invoke the procedure in SQL *Plus.
Which four
are valid invocations? (Choose four)
A. EXECUTE
add_dept(p_loc=>2500)
B. EXECUTE
add_dept('Education', 2500)
C. EXECUTE
add_dept('2500', p_loc =>2500)
D. EXECUTE
add_dept(p_name=>'Education', 2500)
E. EXECUTE
add_dept(p_loc=>2500, p_name=>'Education')
27. Which
two describe a stored procedure? (Choose two)
A. A stored
procedure is typically written in SQL.
B. A stored
procedure is a named PL/SQL block that can accept parameters.
C. A stored
procedure is a type of PL/SQL subprogram that performs an action.
D. A stored
procedure has three parts: the specification, the body, and the exception
handler part.
E. The
executable section of a stored procedure contains statements that assigns
values, control execution, and return values to the calling environment.
28. To be
callable from a SQL expression, a user-defined function must do what?
A. Be stored
only in the database.
B. Have both IN
and OUT parameters.
C. Use the
positional notation for parameters.
D. Return a
BOOLEAN or VARCHAR2 data type.
29. Examine
the procedure:
CREATE OR REPLACE
PROCEDURE INSERT TEAM (V_ID in NUMBER,
V_CITY in
VARCHER2 DEFAULT ‘AUSTIN’, V_NAME in
VARCHER2)
IS
BEGIN
INSERT INTO
TEAM (id, city, name)
VALUES
(v_id,v_city,v_name);
COMMIT;
END;
Which two
statements will successfully invoke this procedure in SQL Plus? (Choose two)
A. EXECUTE
INSERT_TEAM;
B. EXECUTE
INSERT_TEAM (3, V_NAME=>'LONGHORNS', V_CITY=>'AUSTIN');
C. EXECUTE
INSERT_TEAM (3, 'AUSTIN', 'LONGHORNS');
D. EXECUTE
INSERT_TEAM (V_ID := V_NAME := 'LONGHORNS', V_CITY := 'AUSTIN');
E. EXECUTE
INSERT_TEAM (3, 'LONGHORNS');
30. How can
you migrate from a LONG to a LOB data type for a column?
A. Use the
DBMS_MANAGE_LOB.MIGRATE procedure.
B. Use the
UTL_MANAGE_LOB.MIGRATE procedure.
C. Use the
DBMS_LOB.MIGRATE procedure.
D. Use the
ALTER TABLE command.
E. You cannot
migrate from a LONG to a LOB date type for a column.
31. You need
to remove the database trigger BUSINESS_HOUR. Which command do you use
to remove
the trigger in the SQL *Plus environment?
A. DROP TRIGGER
business_hour;
B. DELETE
TRIGGER business_hour;
C. REMOVE
TRIGGER business_hour;
D. ALTER
TRIGGER business_hour REMOVE;
E. DELETE FROM
USER_TRIGGERS WHERE TRIGGER_NAME = .BUSINESS_HOUR;
32. A CALL
statement inside the trigger body enables you to call ______.
A. A package.
B. A stored
function.
C. A stored
procedure.
D. Another
database trigger.
33. You are
about to change the arguments of the CALC_TEAM_AVG function. Which dictionary
view can you query to determine the names of the procedures and functions that invoke
the CALC_TEAM_AVG function?
A.
USER_PROC_DEPENDS
B.
USER_DEPENDENCIES
C.
USER_REFERENCES
D. USER_SOURCE
34. You
create a DML trigger. For the timing information, which is valid with a DML
trigger?
A. DURING
B. INSTEAD
C. ON SHUTDOWN
D. BEFORE
E. ON STATEMENT
EXECUTION
35. Which
type of argument passes a value from a procedure to the calling environment?
A. VARCHAR2
B. BOOLEAN.10
C. OUT
D. IN
36. You want
to create a PL/SQL block of code that calculates discounts on customer orders. This
code will be invoked from several places, but only within the program unit ORDERTOTAL.
What is the most appropriate location to store the code that calculates the discounts?
A. A stored
procedure on the server.
B. A block of
code in a PL/SQL library.
C. A standalone
procedure on the client machine.
D. A block of
code in the body of the program unit ORDERTOTAL.
E. A local
subprogram defined within the program unit ORDERTOTAL.
37. Which
statement about triggers is true?
A. You use an
application trigger to fire when a DELETE statement occurs.
B. You use a
database trigger to fire when an INSERT statement occurs.
C. You use a
system event trigger to fire when an UPDATE statement occurs.
D. You use
INSTEAD OF trigger to fire when a SELECT statement occurs.
38. Examine
this procedure:
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;
This
procedure must invoke the UPD_BAT_STAT procedure and pass a parameter. Which
statement, when added to the above procedure will successfully invoke the UPD_BAT_STAT procedure?
A. EXECUTE
UPD_BAT_STAT(V_ID);
B.
UPD_BAT_STAT(V_ID);
C. RUN
UPD_BAT_STAT(V_ID);
D. START
UPD_BAT_STAT(V_ID);
39. Which
four triggering events can cause a trigger to fire? (Choose four)
A. A specific
error or any errors occurs.
B. A database
is shut down or started up.
C. A specific
user or any user logs on or off.
D. A user
executes a CREATE or an ALTER table statement.
E. A user
executes a SELECT statement with an ORDER BY clause.
F. A user
executes a JOIN statement that uses four or more tables.
40. When
creating a function in SQL*Plus, you receive this message: .Warning: Function created
with compilation errors.. Which command can you issue to see the actual error message?
A. SHOW
FUNCTION_ERROR
B. SHOW
USER_ERRORS
C. SHOW ERRORS
D. SHOW
ALL_ERRORS
41. There is
a CUSTOMER table in a schema that has a public synonym CUSTOMER and you are
granted all object privileges on it. You have a procedure PROCESS_CUSTOMER that
processes customer information that is in the public synonym CUSTOMER table.
You have just created a new table called CUSTOMER within your schema. Which
statement is true?
A. Creating the
table has no effect and procedure PROCESS_CUSTOMER still accesses data from public synonym CUSTOMER table.
B. If the
structure of your CUSTOMER table is the same as the public synonym CUSTOMER
table then the procedure PROCESS_CUSTOMER is invalidated and gives compilation
errors.
C. If the
structure of your CUSTOMER table is entirely different from the public synonym CUSTOMER
table then the procedure PROCESS_CUSTOMER successfully recompiles and accesses your
CUSTOMER table.
D. If the
structure of your CUSTOMER table is the same as the public synonym CUSTOMER
table then the procedure PROCESS_CUSTOMER successfully recompiles when invoked
and accesses your CUSTOMER table.
42. Examine
this package:
CREATE OR
REPLACE PACKAGE BB_PACK
IS
V_MAX_TEAM_SALARY
NUMBER (12,2);
PROCEDURE
ADD_PLAYER (V_ID IN NUMBER, V_LAST_NAME VARCHAR2, V_SALARY_NUMBER)
END BB_PACK;
/
CREATE OR
REPLACE PACKAGE BODY BB_PACK
IS
PROCEDURE UPD_PLAYER_STAT
(V_ID IN NUMBER, V_AB IN NUMBER DEFAULT 4,
V_HITS IN NUMBER)
IS
BEGIN
UPDATE
PLAYER_BAT_STAT
SET AT_BATS
= AT_BATS + V_AB,
HITS = HITS
+ V_HITS
WHERE
PLAYER_ID = V_ID;
COMMIT;
END UPD_PLAYER_STAT;
PROCEDURE
ADD_PLAYER (V_ID IN NUMBER, V_LAST_NAME VARCHAR2, V_SALARY NUMBER)
IS
BEGIN
INSERT INTO PLAYER(ID,LAST_NAME,SALARY)
VALUES
(V_ID, V_LAST_NAME, V_SALARY);
UPD_PLAYER_STAT(V_ID,0.0);
END
ADD_PLAYER;
END BB_PACK;
Which
statement will successfully assign $75,000,000 to the V_MAX_TEAM_SALARY
variable from within a
stand-alone
procedure?
A.
V_MAX_TEAM_SALARY := 7500000;
B.
BB_PACK.ADD_PLAYER.V_MAX_TEAM_SALARY := 75000000;
C. BB_PACK.V_MAX_TEAM_SALARY
:= 75000000;
D. This
variable cannot be assigned a value from outside the package.
43. Examine
this code:
CREATE OR REPLACE TRIGGER update_emp
AFTER UPDATE
ON emp
BEGIN
INSERT INTO
audit_table (who, dated)
VALUES
(USER, SYSDATE);
END;
You issue an
UPDATE command in the EMP table that results in changing 10 rows. How many rows are inserted into the
AUDIT_TABLE ?
A. 1
B. 10
C. None
D. A value
equal to the number of rows in the EMP table.
44. Examine
this package
CREATE OR
REPLACE PACKAGE discounts
IS
G_ID
NUMBER:=7839;
DISCOUNT_RATE
NUMBER:= 0. 00;
PROCEDURE
DISPLAY_PRICE (V_PRICE NUMBER);
END
DISCOUNTS;
/
CREATE OR
REPLACE PACKAGE BODY discounts
IS
PROCEDURE
DISPLAY_PRICE (V_PRICE_NUMBER)
IS
BEGIN
DBMS_OUTPUT.PUT_LINE(‘DISCOUNTED||2_4
(V_PRICE*NVL(DISCOUNT_RATE,
1)))
END
DISPLAY_PRICE;
BEGIN
DISCOUNT_RATE;=0. 10;
END
DISCOUNTS;
/
Which
statement is true?
A. The value of
DISCOUNT_RATE always remain 0. 00 in a session.
B. The value of
DISCOUNT_RATE is set to 0. 10 each time the package are invoked in a session.
C. The value of
DISCOUNT_RATE is set to 1 each time the procedure DISPLAY_PRICE is invoked.
D. The value of
DISCOUNT_RATE is set to 0. 10 when the package is invoked for first time in a session.
45. Examine
this code:
CREATE OR
REPLACE TRIGGER secure_emp
BEFORE LOGON
ON employees
BEGIN
IF
(TO_CHAR(SYSDATE, .DY.) IN ( .SAT., .SUN.)) OR
(TO_CHAR(SYSDATE,
.HH24:MI .) NOT BETWEEN .08:00 AND .18:00 ) THEN
RAISE_APPLICATION_ERROR (-20500, ‘You may insert
into EMPLOYEES table only during business hours. ‘);
END IF;
END;
What type of
trigger is it?
A. DML trigger
B. INSTEAD OF
trigger
C. Application
trigger
D. System event
trigger
E. This is an
invalid trigger.
46. Which
table should you query to determine when your procedure was last compiled?
A.
USER_PROCEDURES
B. USER_PROCS
C. USER_OBJECTS
D.
USER_PLSQL_UNITS
47. Examine
this code:
CREATE OR
REPLACE FUNCTION gen_email_name (p_first_name VARCHAR2, p_last_name VARCHAR2,
p_id NUMBER)
RETURN VARCHAR2
is
v_email_name
VARCHAR2 (19);
BEGIN
v_email_home := SUBSTR(p_first_name, 1, 1) ||
SUBSTR(p_last_name, 1, 7) ||’@Oracle.com ‘;
UPDATE
employees SET email = v_email_name
WHERE
employee_id = p_id;
RETURN v_email_name;
END;
You run this
SELECT statement:
SELECT
first_name, last_name gen_email_name(first_name, last_name, 108) EMAIL FROM
employees;
What occurs?
A. Employee 108
has his email name updated based on the return result of the function.
B. The
statement fails because functions called from SQL expressions cannot perform
DML.
C. The
statement fails because the functions does not contain code to end the
transaction.
D. The SQL
statement executes successfully, because UPDATE and DELETE statements are
ignoring in stored functions called from SQL expressions.
E. The SQL
statement executes successfully and control is passed to the calling
environment.
48. What
part of a database trigger determines the number of times the trigger body
executes?
A. Trigger type
B. Trigger body
C. Trigger
event
D. Trigger timing
49. What
happens during the execute phase with dynamic SQL for INSERT, UPDATE, and DELETE
operations?
A. The rows are
selected and ordered.
B. The validity
of the SQL statement is established.
C. An area of
memory is established to process the SQL statement.
D. The SQL
statement is run and the number of rows processed is returned.
E. The area of
memory established to process the SQL statement is released.
50. Given a
function CALCTAX :
CREATE OR
REPLACE FUNCTION calc tax (sal NUMBER)
RETURN NUMBER
IS
BEGIN RETURN
(sal * 0.05);
END;
If you want
to run the above function from the SQL *Plus prompt, which statement is true?
A. You need to
execute the command CALCTAX(1000); .
B. You need to
execute the command EXECUTE FUNCTION calc tax; .
C. You need to
create a SQL *Plus environment variable X and issue the command :X :=
CALCTAX (1000);
.
D. You need to
create a SQL *Plus environment variable X and issue the command EXECUTE :X :=
CALCTAX;
E. You need to
create a SQL *Plus environment variable X and issue the command EXECUTE :X :=
CALCTAX(1000);
51. Which
two dictionary views track dependencies? (Choose two)
A. USER_SOURCE
B. UTL_DEPTREE
C. USER_OBJECTS
D.
DEPTREE_TEMPTAB
E.
USER_DEPENDENCIES
F.
DBA_DEPENDENT_OBJECTS
52. Which
statements are true? (Choose all that apply)
A. If errors
occur during the compilation of a trigger, the trigger is still created.
B. If errors
occur during the compilation of a trigger you can go into SQL *Plus and query
the USER_TRIGGERS data dictionary view to see the compilation errors.
C. If errors
occur during the compilation of a trigger you can use the SHOW ERRORS command within
iSQL *Plus to see the compilation errors.
D. If errors
occur during the compilation of a trigger you can go into SQL *Plus and query
the USER_ERRORS data dictionary view to see compilation errors.
53. You need
to create a trigger on the EMP table that monitors every row that is changed
and places this information into the AUDIT_TABLE. What type of trigger do you
create?
A. FOR EACH ROW
trigger on the EMP table.
B.
Statement-level trigger on the EMP table.
C. FOR EACH ROW
trigger on the AUDIT_TABLE table.
D.
Statement-level trigger on the AUDIT_TABLE table.
E. FOR EACH ROW
statement-level trigger on the EMP table.
54. Examine
this package:
CREATE OR REPLACE PACKAGE BB:PACK
CREATE OR REPLACE PACKAGE BB:PACK
IS
V_MAX_TEAM:
SALARY NUMBER(12,2);
PROCEDURE ADD_PLAYER(V_ID IN
NUMBER,V_LAST_NAME VARCHAR2, V_SALARY NUMBER);
END BB_PACK;
/
CREATE OR
REPLACE PACKAGE BODY BB_PACK
IS
PROCEDURE
UPD_PLAYER_STAT (V_ID IN
NUMBER, V_AB
IN NUMBER DEFAULT 4, V_HITS IN NUMBER)
IS
BEGIN
UPDATE
PLAYER_BAT_STAT
SET
AT_BATS =
AT_BATS + V_AB,
HITS = HITS
+ V_HITS WHERE
PLAYER_ID =
V_ID; COMMIT;
END
UPD_PLAYER_STAT;
PROCEDURE
ADD_PLAYER
(V_ID IN
NUMBER, V_LAST_NAME VARCHAR2, V_SALARY NUMBER)
IS
BEGIN
INSERT INTO
PLAYER(ID,LAST_NAME,SALARY)
VALUES
(V_ID, V_LAST_NAME,
V_SALARY);
UPD_PLAYER_STAT(V_ID,0,0);
END
ADD_PLAYER;
END BB_PACK;
You make a
change to the body of the BB_PACK package. The BB_PACK body is recompiled. What
happens if the
stand alone procedure VALIDATE_PLAYER_STAT references this package?
A.
VALIDATE_PLAYER_STAT cannot recompile and must be recreated.
B.
VALIDATE_PLAYER_STAT is not invalidated.
C.
VALDIATE_PLAYER_STAT is invalidated.
D.
VALIDATE_PLAYER_STAT and BB_PACK are invalidated.
55. Which
statement is valid when removing procedures?
A. Use a drop
procedure statement to drop a standalone procedure.
B. Use a drop
procedure statement to drop a procedure that is part of a package. Then
recompile thepackage specification.
C. Use a drop
procedure statement to drop a procedure that is part of a package. Then
recompile the package body.
D. For faster
removal and re-creation, do not use a drop procedure statement. Instead,
recompile the procedure using the alter procedure statement with the REUSE
SETTINGS clause.
56. Examine
this code:
CREATE OR
REPLACE PACKAGE bonus IS
g_max_bonus
NUMBER := .99;
FUNCTION
calc_bonus (p_emp_id NUMBER) RETURN NUMBER;
FUNCTION
calc_salary (p_emp_id NUMBER) RETURN NUMBER;
END; /
CREATE OR
REPLACE PACKAGE BODY bonus
IS
v_salary
employees.salary%TYPE;
v_bonus
employees.commission_pct%TYPE;
FUNCTION
calc_bonus (p_emp_id NUMBER)
RETURN
NUMBER
IS
BEGIN
SELECT
salary, commission_pct
INTO
v_salary, v_bonus
FROM
employees
WHERE
employee_id = p_emp_id;
RETURN
v_bonus * v_salary;
END
calc_bonus
FUNCTION
calc_salary (p_emp_id NUMBER)
RETURN
NUMBER
IS
BEGIN SELECT
salary, commission_pct INTO v_salary, v_bonus
FROM
employees
WHERE employees
RETURN v_bonus * v_salary + v_salary;
END cacl_salary;
END bonus; /
Which statement is true?
A. You can call
the BONUS.CALC_SALARY packaged function from an INSERT command against the
EMPLOYEES table.
B. You can call
the BONUS.CALC_SALARY packaged function from a SELECT command against.15 the EMPLOYEES table.
C. You can call
the BONUS.CALC_SALARY packaged function form a DELETE command against
the EMPLOYEES table.
D. You can call
the BONUS.CALC_SALARY packaged function from an UPDATE command
against the EMPLOYEES table.
57. Which
code can you use to ensure that the salary is not increased by more than 10% at
a
time nor is
it ever decreased?
A. ALTER TABLE
emp ADD CONSTRAINT ck_sal CHECK (sal BETWEEN sal AND sal*1.1);
B. CREATE OR
REPLACE TRIGGER check_sal
BEFORE UPDATE OF sal ON emp
FOR EACH ROW
WHEN (new.sal
< old.sal OR new.sal > old.sal * 1.1)
BEGIN
RAISE_APPLICATION_ERROR
( - 20508, .Do not decrease salary not increase by more than 10% );
END;
C. CREATE OR
REPLACE TRIGGER check_sal BEFORE UPDATE OF sal ON emp WHEN
(new.sal <
old.sal OR new.sal > old.sal * 1.1) BEGIN RAISE_APPLICATION_ERROR ( - 20508,
.Do not
decrease salary not increase by more than 10% ); END;
D. CREATE OR
REPLACE TRIGGER check_sal AFTER UPDATE OR sal ON emp WHEN
(new.sal <
old.sal OR -new.sal > old.sal * 1.1) BEGIN RAISE_APPLICATION_ERROR ( -
20508,
.Do not
decrease salary not increase by more than 10% ); END;
58. Which
two statements describe the state of a package variable after executing the
package in which it is declared? (Choose two)
A. It persists
across transactions within a session.
B. It persists
from session to session for the same user.
C. It does not
persist across transaction within a session.
D. It persists
from user to user when the package is invoked.
E. It does not
persist from session to session for the same user.
59. Which
two programming constructs can be grouped within a package? (Choose two)
A. Cursor
B. Constant
C. Trigger
D. Sequence
E. View
60. Which
two statements about packages are true? (Choose two)
A. Packages can
be nested.
B. You can pass
parameters to packages.
C. A package is
loaded into memory each time it is invoked.
D. The contents
of packages can be shared by many applications.
E. You can
achieve information hiding by making package constructs private.
61. Examine
this code:
CREATE OR
REPLACE PRODECURE add_dept (p_dept_name VARCHAR2 DEFAULT ‘placeholder’,
p_location VARCHAR2 DEFAULT ‘Boston’)
IS
BEGIN
INSERT INTO
departments
VALUES
(dept_id_seq.NEXTVAL, p_dept_name, p_location);
END
add_dept; /
Which three
are valid calls to the add_dep procedure ? (Choose three)
A. add_dept;
B. add_dept( ‘Accounting
‘);
C. add_dept(, ‘New
York’ );
D.
add_dept(p_location=> ‘New York’);
62. You have
created a stored procedure DELETE_TEMP_TABLE that uses dynamic SQL to
remove a
table in your schema. You have granted the EXECUTE privilege to user A on this
procedure.
When user A executes the DELETE_TEMP_TABLE procedure, under whose
privileges
are the operations performed by default?
A. SYS
privileges
B. Your
privileges
C. Public
privileges
D. User A.s
privileges
E. User A
cannot execute your procedure that has dynamic SQL.
63. Which
three are true statements about dependent objects? (Choose three)
A. Invalid
objects cannot be described.
B. An object
with status of invalid cannot be a referenced object.
C. The Oracle
server automatically records dependencies among objects.
D. All schema
objects have a status that is recorded in the data dictionary.
E. You can view
whether an object is valid or invalid in the USER_STATUS data dictionary view.
F. You can view
whether an object is valid or invalid in the USER_OBJECTS data dictionary view.
64. Examine
this function:
CREATE OR
REPLACE FUNCTION CALC_PLAYER_AVG (V_ID in PLAYER_BAT_STAT.PLAYER_ID%TYPE)RETURN
NUMBER
IS
V_AVG
NUMBER;
BEGIN
SELECT HITS
/ AT_BATS
INTO V_AVG
FROM
PLAYER_BAT_STAT
WHERE PLAYER_ID
= V_ID;
RETURN
(V_AVG);
END;
Which
statement will successfully invoke this function in SQL *Plus?
A. SELECT
CALC_PLAYER_AVG(PLAYER_ID) FROM PLAYER_BAT_STAT;
B. EXECUTE CALC_PLAYER_AVG
(31);
C. CALC_PLAYER
(.RUTH.);
D.
CALC_PLAYER_AVG(31);
E. START
CALC_PLAYER_AVG(31)
65. The
number of cascading triggers is limited by which data base initialization
parameter?
A.
CASCADE_TRIGGER_CNT.
B.
OPEN_CURSORS.
C.
OPEN_TRIGGERS.
D. OPEN_DB_TRIGGERS.
66. Which
type of package construct must be declared both within the package
specification and
package
body?
A. All package
variables.
B. Boolean
variables.
C. Private
procedures and functions.
D. Public
procedures and functions.
67. Why do
stored procedures and functions improve performance? (Chose two)
A. They reduce
network round trips.
B. They
postpone PL/SQL parsing until run time.
C. They allow
the application to perform high speed processing locally.
D. They reduce
the number of calls to the database and decrease network traffic by bundling commands.
E. They reduce
the number of calls to the database and decrease network traffic by using the
local PL/SQL engine.
68. When
creating store procedures and functions which construct allows you to transfer
values
to and from
the calling environment?
A. Local
variables.
B. Arguments.
C. Boolean
variables.
D. Substitution
variables.
69. You need
to remove database trigger BUSINESS_RULE. Which command do you use to remove
the trigger in the SQL*Plus environment?
A. DROP TRIGGER
business_rule;
B. DELETE
TRIGGER business_rule;
C. REMOVE
TRIGGER business_rule;
D. ALTER
TRIGGER business_rule;
E. DELETE FROM
USER_TRIGGER
F. WHERE
TRIGGER_NAME= ‘BUSINESS_RULE’;
70. Which
two tables are fused track object dependencies? (Choose two)
A.
USER_DEPENDENCIES.
B.
USER_IDEPTREE.
C. IDEPTREE.
D.
USER_DEPTREE.
E.
USER_DEPENDS.
71. The
QUERY_PRODUCT procedure directly references the product table. There is a NEW_PRODUCT_VIEW
view created based on the NOT NULL columns of the table. The ADD_PRODUCT
procedure updates the table indirectly by the way of NEW_PRODUCT_VIEW view.
Under which circumstances does the procedure
ADD_PRODUCT
get invalidated but automatically get complied when invoked?
A. When the NEW_PRODUCT_VIEW
is dropped.
B. When rows of
the product table are updated through SQL Plus.
C. When the
internal logic of the QUERY_PRODUCT procedure is modified.
D. When a new
column that can contain null values is added to the product table.
E. When a new
procedure s created that updates rows in the product table directly.
72. You need
to recompile several program units you have recently modified through a PL/SQL program.
Which statement is true?.18
A. You cannot
recompile program units using a PL/SQL program.
B. You can use
the DBMS_DDL. REOMPILE package procedure to recompile the program units.
C. You can use
the DBMS_ALTER. COMPILE packaged procedure to recompile the program units.
D. You can use
the DBMS_DDL.ALTER_COMPILE packaged procedure to recompile the program units.
E. You can use
the DBMS_SQL.ALTER_COMPILE packaged procedure to recompile the program units.
73. Which
type of argument passes a value from a calling environment?
A. VARCHER2.
B. BOOLEAN.
C. OUT.
D. IN.
74. In order
for you to create run a package MAINTAIN_DATA which privilege do you need?
A. EXECUTE
privilege on the MAINTAIN_DATA package.
B. INVOKE
privilege on the MAINTAIN_DATA package.
C. EXECUTE
privilege on the program units in the MAINTAIN_DATA package.
D. Object
privilege on all of the objects that the MAINTAIN_DATA package is accessing.
E. Execute
privilege on the program units inside the MAINTAIN_DATA package and execute
privilege on
the MAINTAIN_DATA package.
75. You have
created a script file EMP_PROC.SQL that holds the text to create a procedure PROCESS_EMP.
You have compiled the procedure for SQL Plus environment by running the script
file EMP_PROC.SQL. What happens if there are syntax errors in the procedure PROCESS_EMP?
A. The errors
are stored in the EMP_PROC.ERR file.
B. The errors
are displayed to the screen when the script file is run.
C. The errors
are stored in the procedure_errors data dictionary view.
D. YOU need to
issue the SHOW ERRORS command in the SQL Plus environment to see the errors.
E. YOU need to
issue the display errors command in the SQL Plus environment to see the errors.
76. Which
statement about the local dependent object is TRUE?
A. They are on
different nodes.
B. They are in
a different database.
C. They are on
the same node in the same database.
D. They are on
the same node in a different database.
77. You need
to create a stored procedure, which deletes rows from a table. The name of the
table from which the rows are to be deleted is unknown until run time. Which
method do you implement while creating such a procedure?
A. Use SQL
command delete in the procedure to delete the rows.
B. Use DBMS_SQL
packaged routines in the procedure to delete the rows.
C. Use DBMS_DML
packaged routines in the procedure to delete the rows.
D. Use
DBMSDELETE packaged routines in the procedure to delete the rows.
E. You cannot
have a delete statement without providing a table name before compile time.
78. Under
which situation do you create a server side procedure?
A. When the
procedure contains no SQL statements.
B. When the
procedure contains no PL/SQL commands.
C. When the
procedure needs to be used by many client applications accessing several remote
databases.
D. When the
procedure needs to be used by many users accessing the same schema objects on a
local database.
79. Examine
this function
CREATE OR
REPLACE FUNCTION CALC_PLAYER_AVG
(V_ID in
PLAYER_BAT_STAT. PLAYER_ID%TYPE)
RETURN
NUMBER
IS
V_AVG
NUMBER;
SELECTS
HITS/AT_BATS
INTO V_AVG
FROM
PLAYER_BAT_STAT
WHERE
PLAYER_ID_V_ID;
RETURN(V_AVG);
END;
This
function must be moved to a package. Which additional statement must be added
to the function to allow you to continue using the function in the group by the
clause of a select statement?
A. PRAGMA
RESTRICT_REFERENCES (CALC_PLAYER_AVG, WNDS, WNPS);
B. PRAGMA
RESTRICT_REFERENCES (CALC_PLAYER_AVG, WNPS);
C. PRAGMA
RESTRICT_REFERENCES (CALC_PLAYER_AVG, RNPS, WNPS);
D. PRAGMA
RESTRICT_REFERENCES (CALC_PLAYER_AVG, ALLOW_GROUP_BY);
80. Which
code successfully calculates tax?
A. CREATE OR
REPLACE PROCEDURE calc (p_no IN NUMBER)
RETURN tax
IS
V_sal NUMBER;
Tax NUMBER;
BEGIN
SELECT sal
INTO v_sal
FROM emp
WHERE
EMPNO=p_no;
Tax:=v_sal * 0.
05;
END;
B. CREATE OR
REPLACE FUNCTION calctax (p_no NUMBER)
RETURN NUMBER
IS
V_sal NUMBER;
BEGIN
SELECT sal
INTO v_sal
FROM emp
WHERE empno
=p_no;
RETURN (v_sal*
0. 05);
END;
C. CRETAE OR
REPLACE FUNCTION calctax(p_no NUMBER)
RETURN NUMBER
IS
V_sal NUMBER;
Tax NUMBER;
BEGIN
SELECT sal INTO
v_sal
FROM emp
WHERE empno
=p_no;
Tax:=v_sal * 0.
05;
END;
D. CREATE OR
REPLACE FUNCTION calctax(p_no NUMBER)IS
V_sal NUMBER;
Tax NUMBER;
BEGIN
SELECT sal INTO
v_sal
FROM emp
WHERE empno
=p_no;
Tax :=v_sal *
0. 05;
RETURN(tax);
END;
81. The
programmer view developed a procedure ACCOUNT_TRANSACTION left organization.
You were assigned a task to modify this procedure. YOU want to find all the program
units invoking the ACCOUNT_TRANSACTION procedure. How can you find this
information?
A. Query the
USER_SOURCE data dictionary view.
B. Query the
USER_PROCEDURES data dictionary view.
C. Query the
USER_DEPENDENCIES data dictionary views.
D. Set the SQL
Plus environment variable trade code=true and run the ACCOUNT_TRANSACTION procedure.
E. Set the SQL
Plus environment variable DEPENDENCIES=TRUE and run the Account_Transaction
procedure.
82. Which
two statements about the overloading feature of packages are true? (Choose two)
A. Only local
or packaged sub programs can be overloaded.
B. Overloading
allows different functions with the same name that differ only in their return
types.
C. Overloading
allows different subprograms with the same number, type and order of the
parameter.
D. Overloading
allows different subprograms with the same name and same number or type of the parameters.
E. Overloading
allows different subprograms with the same name but different in either number
or type or order of parameter.
83. All
users currently have the INSERT privileges on the PLAYER table. You want only
your users to insert into this table using the ADD_PLAYER procedure. Which two
actions must you take? (Choose two)
A. GRANT SELECT
ON ADD_PLAYER TO PUBLIC;
B. GRANT
EXECUTE ON ADD_PLAYER TO PUBLIC;
C. GRANT INSERT
ON PLAYER TO PUBLIC;
D. GRANT
EXECUTE, INSERT ON ADD_PLAYER TO PUBLIC;
E. REVOKE
INSERT ON PLAYER FROM PUBLIC;
84. Which
Oracle supply package allows you to run jobs at user defined times?
A. DBMS_JOB
B. DBMS_RUN
C. DBMS_PIPE
D. DBMS_SQL
85. You need
to drop a table from within a stored procedure. How do you implement this?
A. You cannot
drop a table from a stored procedure.
B. Use the DROP
command in the procedure to drop the table.
C. Use the
DBMS_DDL packaged routines in the procedure to drop the table.
D. Use the
DBMS_SQL packaged routines in the procedure to drop the table.
E. Use the
DBMS_DROP packaged routines in the procedure to drop the table.
86. Which
data dictionary views give you the names and the source code of all the
procedures that you have created?
A. USER_SOURCE
B. USER_OBJECTS
C.
USER_PROCEDURES
D.
USER_SUBPROGRAMS
87. Examine
this package
CREATE OR
REPLACE PACKAGE BB_PACK
IS
V_MAX_TEAM_SALARY
NUMBER(12,2);
PROCEDURE
ADD_PLAYER(V_ID IN NUMBER, V_LAST_NAME VARCHAR2,V_SALARY NUMBER);
END BB_PACK;
/
CREATE OR
REPLACE PACKAGE BODY BB_PACK
IS
V_PLAYER_AVG
NUMBER(4,3);
PROCEDURE
UPD_PLAYER_STAT
V_ID IN
NUMBER, V_AB IN NUMBER DEFAULT4, V_HITS IN NUMBER)
IS
BEGIN
UPDATE
PLAYER_BAT_STAT
SET
ADD_BAT=ADD_BATS+V_AB,
HITS=HITS+V_HITS
WHERE
PLAYER_ID=V_ID;
COMMIT;
VALIDATE_PLAYER_STAT(V_ID);
END
UPD_PLAYER_STAT;
PROCEDURE
ADD_PLAYER
(V_ID IN
NUMBER, V_LAST_NAME, VARCHAR2, V_SALARY IN NUMBER);
IS
BEGIN
INSERT INTO
PLAYER (ID, LAST_NAME, SALARY)
VALUES(V_ID,
V_LAST_NAME, V_SALARY);
UPD_PLAYER_STAT(V_ID,0,0);
END
ADD_PLAYER;
END
BB_PACK;.22
Which kind
of packaged variables is V_MAX_TEAM_SALARY?
A. PRIVATE
B. PUBLIC
C. IN
D. OUT
88. Examine
this trigger.
CREATE OR
REPLACE TRIGGER UPD_TEAM_SALARY
AFTER INSERT
OR UPDATE OR DELETE ON PLAYER
FOR EACH ROW
BEGIN
UPDATE TEAM
SET
TOT_SALARY=TOT_SALARY+:NEW SALARY.
WHERE
ID=:NEW:TEAM_ID;
You will be
adding additional coat later but for now you want the current block to fire
when updated the salary column. Which solution should you use to verify that the
user is performing an update on the salary column?
A.
ROW_UPDATE(‘SALARY’)
B.
UPDATING(‘SALARY’)
C.
CHANGING(‘SALARY’)
D.
COLUMN_UPDATE(‘SALARY’)
89. Examine
this package:
CREATE OR
REPLACE PACKAGE BB_PACK
V_MAX_TEAM_SALARY
NUMBER(12,2);
PROCEDURE
ADD_PLAYER(V_ID IN NUMBER, V_LAST_NAME
VARCHAR2,
V_SALARY NUMBER);
BB_PACK;
CREATE OR REPLACE PACKAGE BODY BB_PACK
IS
V_WHERE_AVG
NUMBER(4,3);
PROCEDURE
UPD_PLAYER_STAT
(V_ID IN
NUMBER, V_AVG IN NUMBER DEFAULT 4,V_HITS IN NUMBER)
IS
BEGIN
UPDATE
PLAYER_BAT_STAT
SET
AT_BATS=AT_BATS+V_AB,
HITS=HITS+V_HITS
WHERE
PLAYER_ID=V_ID;
COMMIT;
VALIDATE_PLAYER_STAT(V_ID);
END
UPD_PLAYER_STAT;
PROCEDURE
ADD-PLAYER
(V_ID IN
NUMBER, V_LAST_NAME VARCHAR2, V_SALARY NUMBER)
IS
BEGIN
INSERT INTO
PLAYER(ID, LAST_NAME, SALARY)
VALUES(V_ID,
V_LAST_NAME, V_SALARY);
UPD_PLAYER_STAT(V_ID,0,0);
END
ADD_PLAYER;
END BB_PACK;
An outside
procedure VALIDATE_PLAYER_STAT is executed from this package.What will happen
when this procedure changes?
A. The package
specification is dropped.
B. The package
specification is invalidated.
C. The package
is invalidate.
D. The package
body is invalidated.
90. The
PROCEDURE_ADD_PRODUCT is defined within a package specifications as follows:
PROCEDURE_ADD_PRODUCT
(P_PRODNO NUMBER,P_PRODNAME VARCHER2);
Which
procedure declaration can’t be added to package specifications?
A. PROCEDURE
add_product (p_order_date DATE);
B. PROCEDURE
add_product (p_name VARCHER2, P_ORDERED DATE);
C. PROCEDURE
add_product (p_prodname VARCHER2, P_PRISE NUMBER);
D. PROCEDURE
add_product (p_prize NUMBER, P_DESCRIPTION VARCHER2);
91. Examine
this package
CREATE OR
REPLACE PACKAGE PACK_CUR
IS
CURSOR C1 IS
SELECT
PRODID
FROM PRODUCT
ORDER BY
PRODID DESC;
PROCEDURE
PROC1;
PROCEDURE
PROC2;
END
PACK_CUR;
/
CREATE OR
REPLACE PACKAGE BODY PACK_CUR
IS
V_ID NUMBER;
PROCEDURE
PROC1 IS
BEGIN
OPEN C1;
LOOP
FETCH C1
INTO V_PRODID;
DBMS_OUTPUT.
PUT_LINE (ROW IS :,||C1/ROWCOUNT);
EXIT WHEN
C1/ROWCOUNT>=3;
END LOOP;
END PROC1;
PROCEDURE
PROC2 IS
BEGIN
LOOP
FETCH C1 TO
V_PRODID
DBMS_OUTPUT.
PUT_LINE (ROW IS :,||C1/ROWCOUNT);
EXIT WHEN
C1/ROWCOUNT>=6;
END LOOP;
CLOSE C1;
END PROC2;
END
PACK_CUR;
/
The products
table has more than 1000 rows. The SQL plus server output setting is turned on
in your session. You execute procedure proc1 from sql plus with the command:
EXECUTE
PACK_CUR.PROC1. What is the output in your session?
A. Error at
line 1
B. Row is:
Row is:
Row is:
C. Row is:1
Row is:2
Row is:3
D. Row is:4
Row is:5
Row is:6
92. When
creating procedures, local variables and arguments should be placed after which
key words?
A. IS
B. BEGIN
C. DECLARED
D. PROCEDURE
93. Which
two statements about packages are true? (Choose two)
A. Both
specifications and body are required components of a package.
B. Package
specification is optional but the package body is required.
C. A package
specification is required but the package body is optional.
D. The
specification and body of the package is stored together in a database.
E. The specification
and body of the package are stored separately in the database.
94. You want
to send a message to another session connected to the same instance. Which
Oracle supplied package will you use to achieve this task?
A. DBMS_JOB
B. DBMS_PIPES
C. DBMS_OUTPUT
D. DBMS_MESSAGE
E. SEND_MESSAGE
95. Which
system privileges must you have to manually recompile a stored procedure owned
by another application developer?
A. ALTER
PROCEDURE
B. ALTER ANY
PROCEDURE
C. ALTER ALL
PROCEDURE
D. COMPILE ANY
PROCEDURE
96. Which
situation requires a before update statement level trigger on the table?
A. When you
need to populate values of each updated row into another table.
B. When a
trigger must fire for each row affected by the triggering statement.
C. When you
need to make sure that user making modifications to the table as necessary
privileges.
D. When you
need to store the information of the use who successfully modified tables and
in audit table.
97. Examine
the trigger
Create a
replace trigger cascade_updates
After update
(Deptno) on Dept
For each row
BEGIN
UPDATE EMP
SET
emp_deptno=: new. Deptno
WHERE
emp.Deptno=: old.Deptno;
END
When this
trigger will fire successfully?
A. Only when
the dept no in the emp table holds a NULL value.
B. Irrespective
of any referential integrity constraints between two tables.
C. When there
is no referential integrity between the dept number columns of the emp and the
dept tables within their table definitions.
D. Only when
there is referential integrity constraint between the emp no columns of the emp
and dept tables within their table definitions.
98. Examine
this code:
CREATE OR
REPLACE PROCEUDRE AUDIT_EMP;
(P_ID IN
EMP. EMPNO%TYPE)
IS
V_ID NUMBER;
PROCEDURE
LOG_EXEC
IS
BEGIN
INSERT INTO
LOG_TABLE (USER_ID,LOG_DATE)
VALUES (USERS,SYSDATE);
END LOG_EXEC
V_NAME
VARCHAR2(20)
BEGIN
DELETE FROM
EMP
WHERE EMPNO
= P_ID;
LOG_EXEC;
SELECT
ENAME,EMPNO
INTO
V_NAME,V_ID
FROM EMP
WHERE
EMPNO=P_ID
END
AUDIT_EMP;
Why does
this code cause and error when compiled?
A. An insert
statement is not allowed in a sub program declaration.
B. The LOG_exec
procedure should be declared before any identifiers.
C. The V_NAME
variable should be declared before declaring the LOG_EXEC procedure.
D. The LOG_EXEC
procedure should be invoked as execute log_exec with in the AUDIT_EMP procedure.
99. When
creating a function in which section will you typically find a return key word?
A. Header Only
B. Declarative
C. Executable
and header
D. Executable
and exception handling
100. Examine
this package
CREATE OR REPLACE
PACKAGE COMPILE_THIS
IS
G_VALUE
VARCHAR2(100);
PROCEDURE A;
PROCEDURE B;
END
COMPILE_THIS;
/
CREATE OR
REPLACE PACKAGE BODY COMPILE_THIS
IS
PROCEDURE A
IS
BEGIN
G_VALUE :=
(‘HELLO WORLD’);
END A;
PROCEDURE B
IS
BEGIN
C;
DBMS_OUTPUT.
PUT_LINE (‘PROCEDURE B CALLING C’);
END B;
PROCEDURE C
IS
BEGIN
B;
DBMS_OUTPUT.
PUT_LINE (‘PROCEDURE C CALLING B’);
END;
END
COMILE_THIS; /
Procedure C
is a local construct to the package. What happens when this package is compiled?
A. It produces
the output Procedure B calling C
B. It produces
the output Procedure C calling B
C. It produces
a compilation error because procedure C requires a forward declaration.
D. It produces
a compilation error because procedure B requires a forward declaration.
E. It produces
a compilation error because identified g_value is not declared in procedure A
101. The
ADD_PLAYER, UPD_PLAYER_STAT and UPD_PITCHER_STAT procedures are grouped
together in a package. A variable must be shared among only these procedures.
Where should you declare this variable?
A. In the
package body.
B. In the data
base triggers.
C. In the
package specification.
D. In the
procedures declare section using the exact name in each.
102. Examine
the trigger heading
CREATE OR
REPLACE TRIGGER SALARY_CHECK
Before
update (sal,job) on emp
For each row
Under what
conditions does this trigger fire?
A. When a row
is inserted to EMP table.
B. When the
value of the SAL or JOB column in a row is updated in a emp table.
C. When any
column other than the sal or job columns in a row are updated in the EMP table.
D. Only when
both values of sal or jobs column in a row are updated together in the EMP
table.
103. Which
code can you use to ensure that the salary is neither increased by more than 10%
at a time nor is ever decreased?
A. ALTER TABLE
emp ADD
constraint_ck_sal
CALC(sal BETWEEN sal AND sal*1.1);
B. CREATE OR
REPLACE TRIGGER check_sal
BEFORE UPDATE
OF sal ON emp
FOR EACH ROW
WHEN(NEW.SAL<OLD.SAL
OR
NEW.SAL>OLD.SAL*1.1)
BEGIN
RAISE_APPLICATION_ERROR(-20508,
‘do not decrease salary nor
increase by
more than 10%’);
END;
C. CREATE OR
REPLACE TRIGGER check_sal
BEFORE UPDATE
OF sal OR emp
WHEN
(NEW.SAL<OLD.SAL OR
NEW.SAL>OLD.SAL*1.1)
BEGIN
RAISE_APPLICATION_ERROR(-20508,
‘Do not decrease salary nor
increase by
more than 10%’);
D. CREATE OR
REPLACE TRIGGER check_sal
AFTER UPDATE OF
sal OR emp
WHEN
(NEW.SAL<OLD.SAL OR
NEW.SAL>OLD.SAL*1.1)
BEGIN
RAISE_APPLICATION_ERROR(-20508,
‘Do not decrease salary nor
increase by
more than 10%’);
END;
104. Which
command must you issue to allow users to access the UPD_TEAM_STAT trigger on the
TEAM table?
A. GRANT
SELECT, INSERT, UPDATE, DELETE ON TEAM TO PUBLIC;
B. GRANT
SELECT, INSERT, UPDATE, DELETE ONUPD_TEAM_STAT TO PUBLIC;
C. GRANT
EXECUTE ON TEAM TO PUBLIC;
D. GRANT
SELECT, EXECUTE ON TEAM, UPD_TEAM_STAT TO PUBLIC;
105. Which
compiler directive to check the purity level of functions?
A. PRAGMA
SECURITY_LEVEL.
B. PRAGMA
SEARIALLY_REUSABLE.
C. PRAGMA
RESTRICT_REFERRENCES.
D. PRAGMA
RESTRICT_PURITY_LEVEL.
E. PRAGMA RESTRICT_FUNCTION_REFERRENCE.
106. You
have an AFTER UPDATE row-level trigger on the table EMP. This trigger queries
the EMP table and inserts the updating users information into the AUDIT_TABLE.
What happens when the users update rows on the EMP table?
A. A compile
time error occurs.
B. A run time
error occurs. The effect of the trigger body and the triggering statement are
rolled back.
C. A run time
error occurs. The effect of the trigger body is rolled back but the update on
the EMP table takes place.
D. The trigger
file successfully update the EMP file on the EMP table occurs and the data is
asserted into the AUDIT_TABLE.
E. A run time
error occurs. The update on the EMP table does not take place but the insert
into the AUDIT_TABLE occurs.
107. Given
the header of a procedure ACCOUNT_TRANSACTION:
CREATE OR REPLACE
PROCEDURE ACCOUNT_TRANSACTION
IS
BEGIN
END;
Which
command will execute the PROCEDURE ACCOUNT_TRANSACTION from the SQL Plus
prompt?
A.
ACCOUNT_TRANSACTION;
B. RUN
ACCOUNT_TRANSACTION;
C. START ACCOUNT_TRANSACTION;
D. EXECUTE
ACCOUNT_TRANSACTION;
108. Which
one is the correct routine for the utilization order when using dynamic SQL?
A. Open, Parse,
Bind, Execute, Fetch, Close
B. Parse, Bind,
open, Execute, Close, Fetch
C. Bind, Open,
Parse, Execute, Fetch, Close
D. Open, Bind,
Parse, Execute, Close, Fetch
109. Examine
this trigger:
CREATE OR
REPLACE TRIGGER UPD_PLAYER_STAT_TRIG
AFTER INSERT
ON PLAYER
FOR EACH ROW
BEGIN
INSERT INTO
PLAYER_BAT_STAT(PLAYER_ID, SEASON_YEAR,AT_BATS,HITS)
VALUES(player_id_seq.currval,
1997, 0, 0 );
END;
After
creating this trigger, you test it by inserting a row into the PAYER table. You
receive this
error message:
ORA-04091:
table SCOTT.PLAYER is mutating,trigger/function may not see it.
How can you
avoid getting this error?
A. Drop the
foreign key contraint on the PLAYER_ID column of the PLAYER_BAT_STAT table.
B. Drop the
primary key contraint on the PLAYER_ID column of the PLAYER_BAT_STAT table.
C. Drop the
primary key constraint on the ID column of the PLAYER table.
D. The code of
the trigger is invalid. Drop and recreate the trigger.
110. Examine
this package:.29
CREATE OR
REPLACE PACKAGE manage_emps
IS
Tax_rate
CONSTRAINT NUMBER(5,2):=. 28;
v_id NUMBER;
PROCEDURE
insert_emp(p_dept NO NUMBER, p_sal NUMBER);
PROCEDURE
delete_emp;
PROCEDURE
update_emp;
FUNCTION
calc_text(p_sal NUMBER)
RETURN
NUMBER;
END
manage_emps;
/
CREATE OR
REPLACE PACKAGE BODY manage_emps
IS
PROCEDURE
update_sal
(p_raise_amt
NUMBER)
IS
BEGIN
UPDATE EMP
SET
SAL=(SAL*p_raise_AMP)+SAL WHERE EMPNO=v_id;
END;
PROCEDURE
insert_emp
(p_deptno
NUMBER,p_sal NUMBER)
IS
BEGIN
INSERT INTO
EMP(EMPNO,DEPTNO,SAL)
VALUES(v_id,p_deptno,p_sal);
INERT INTO
EMP;
PROCEURE
delete_emp
IS
BEGIN
DELETE FROM
EMP
WHERE
EMPNO=v_id;
END
delete_emp;
PROCEDURE
audit_emp;
IS
V_sal
NUMBER(10,2);
V_raise
NUMBER(10,2);
IS
SELECT SAL
INTO v_sal
FROM EMP
WHERE
EMPNO=v_id;
IF
v_sal<500 THEN v_raise:=. 05;ELSE
v_sal<1000
THEN v_raise:=. 07;ELSE
v_raise:=.
04;
END IF;
update_sal (v_raise);
END
update_emp; FUNCTION calc_tax
(p_sal
NUMBER)
RETURN
NUMBER
IS
BEGIN
RETURN
p_sal*tax_rate;
END
calc_tax;.30
END
manage_emps;
/
How many
public procedures are there in the MANAGE_EMPS package?
A. 1.
B. 2.
C. 3.
D. 4.
E. 5.
F. None.
111. You
want to execute a procedure from SQL Plus. However you are not sure of the argument
list for this procedure. Which command will display the argument list?
A. DESCRIBE.
B. SHOWLIST.
C. SHOW
ARG_LIST.
D. SHOW
PROCEDURE.
112. You are
creating a stored procedure in the SQL Plus environment. The text of the procedure
is stored in a script file. You run the script file to compile the procedure. What
happens if the procedure contains syntax error?
A. Neither the
source code nor the errors are stored in the database.
B. Both the
source code and the compilation errors are stored in the database.
C. Compilation
errors are appended to the script file that contains the source code.
D. The source
code is stored in the database and the errors are stored in an output file.
E. The only
compilation errors are written to the database and source code remains in the
script file.
113. Which
statement about the forward declarations is true?
A. Forward
declarations are not allowed in packages.
B. Forward
declarations let you use mutually referential subprograms in a package.
C. A forward
declaration means placing a subprogram declaration at the end of the package
body.
D. Forward
declaration in a package specification contains only the name of the sub
program without the formal parameter list.
114. Which
statement is true?
A. Server side
procedures are stored in script files on the server.
B. Server side
procedures are visible in the ALL_SOURCE dictionary view.
C. Server side
procedures are visible in the SERVER_SOURCE dictionary view.
D. Server side
procedures are visible in the SERVER_PROCEDURE data dictionary view.
115. Examine
this package specification:
CREATE OR
REPLACE PACKAGE concat_all
IS
V_string
VARCHER2(100);
PROCEDURE
combine(p_num_val NUMBER);
PROCEDURE
combine (p_dateval DATE);
PROCEDURE
combine(p_char_val VARCHER2,p_num_val NUMBER);
END
concat_all;
Which
overloaded COMBINE procedure declaration can be added to this package specification?
A. PROCEDURE
combine;
B. PROCEDURE
combine (p_no NUMBER);
C. PROCEDURE
combine (p_val_1 VARCHER2,p_val_2 NUMBER);
D. PROCEDURE
concat_all (p_num_val VARCHER2,p_char_val NUMBER);
116. Examine
this package body:
CREATE OR
REPLACE PACKAGE BODY forward_pack
IS
V_sum
NUMBER;
PROCEDURE
calc_ord(. . . );
PROCEDURE
generate_summary(. . . )
IS
BEGIN
Calc_ord(. .
. );
. . .
END
calc_ord;
END forward_pack;
Which
construct has a forward declaration?
A. V_SUM
B. CALC_ORD.
C. FORWARD_PACK
D.
GENERATE_SUMMARY.
117. CREATE
OR REPLACE PROCEDURE manage_emp(p_eno NUMBER)
IS
V_sal
emp.sal%TYPE;
V_job
emp.job%TYPE;
BEGIN
SELECT
sal,job
INTO
v_sal,v_job
FROM emp
WHERE
empno=p_eno;
IF(v_sal<1000)THEN
DBMS_OUTPUT.PUT_LINE(‘Delete
employees who earn less than$1000’);
DELETE FROM
emp
WHERE
empno=p_eno;
ELSE
DBMS_OUTPUT.PUT_LINE(‘Updating
employee salaries.’);
UPDATE emp
SET
sal=sal+100
WHERE
empno=p_eno;
END IF;
END;
/
What
privileges do you need in order to invoke this procedure?
A. No
privileges are required.
B. EXECUTE
privilege on the procedure.
C. EXECUTE
privilege on the DBMS_OUTPUT package.
D. DELETE and
UPDATE privilege on the table EMP.
E. EXECUTE privilege
on the procedure, and delete and update privileges on the table EMP.
118. The
ADD_PLAYER procedure inserts rows into the player table. Which command will show
this direct dependency?
A. SELECT *
FROM USER_DEPENDENCIES WHERE REFFERENCE_NAME= ‘PLAYER’;
B. SELECT *
FROM USER_DEPENDENCIES WHERE REFFERENCE_NAME= ‘ADD_PLAYER’;
C. SELECT *
FROM USER_DEPENDENCIES WHERE TYPE= ‘DIR’;
D. SELECT *
FROM USER_DEPENDENCIES WHERE REFFERENCE_NAME= ‘TABLE’;
119. Examine
this procedure:
CREATE OR
REPLACE PROCEDURE ADD_PLAYER
(V_ID IN
NUMBER, V_LAST_NAME VARCHER2(30))
IS
BEGIN
INSERT INTO
PLAYER(ID, LAST_NAME)
VALUES(V_ID,
V_LAST_NAME);
COMMIT;
END;
Why does
this command fail when executed?
A. When
declaring arguments length is not allowed.
B. When
declaring arguments each argument must have a mode specified.
C. When
declaring arguments each argument must have a length specified.
D. When
declaring a VARCHAR2 argument it must be specified.
120. Examine
this trigger:
CREATE OR
REPLACE TRIGGER CHECK_TOT_SALARY
AFTER INSERT
OR UPDATE OF SALARY ON PLAYER
FOR EACH ROW
DECLARE
V_TOT_SALS
NUMBER(12, 2);
BEGIN
SELECT
SUM(SALARY)
INTO
V_TOT_SAL
FROM PLAYER
WHER
TEAM_ID=:NEW. SALARY;
END;
Why does
this trigger fail when inserting a row into player table?
A. You can’t
read data from a table that is being affected by the same trigger.
B. You can’t
use the sum function with row triggers.
C. You can’t
use the sum function with statement triggers.
D. You can’t
reference :NEW with row triggers.
121. Which
procedure of the dbms_output supply package would you use to append text to the
current line of the output buffer?
A. GET.
B. GET_LINE.
C.
PUT_TEXT_LINE.
D. PUT_LINE.
122. What
happens during the parse phase with dynamic SQL?
A. Rows are
selected and ordered.
B. The number
of rows processed is returned.
C. The validity
of the SQL statement is established.
D. An area of
memory is established to process the SQL statement.
E. An area of
memory is established to process the SQL statement is released.
123. Which
script file must be executed before you can determine indirect independence’s
using
the DEPTREE
AND IDEPTREE VIEWS?
A.
UTL_IDEPT.SQL.
B. UTLIDD.SQL.
C. UTLINDD.SQL.
D. UTLDTREE.SQL
124. Debug
the logic in a stored procedure. How do you monitor the value of variables in
the procedure using SQL Plus environment?
A. INSERT
TEXT_IO.PUT_LINE statement to view data on the screen when the stored procedure
is executed.
B. Insert break
points in the code and observe the variable values displayed to the screen as
the procedure is executed.
C. Insert
DBMS_OUTPUT.PUT_LINE statement to view data on the screen when the stored procedure
is executed.
D. Insert DEBUG
VARIABLE statements to view the variable values on the screen as the procedure
is executed.
125. Which
two statements are true? (Choose two)
A. A function
must return a value.
B. A procedure
must return a value.
C. A function
executes a PL/SQL statement.
D. A function
is invoked as part of an expression.
E. A procedure
must have a return data type specify in its declaration.
126. Which allows
a PL/SQL user define a function?
A. NEXTVAL.
B. HAVING
clause of the SELECT COMMAND.
C. ALTER TABLE
command.
D. FROM clause
of the SELECT AN UPDATE COMMANDS.
127. CREATE
OR REPLACE PROCEDURE set_bonus (p_cutoff IN VARCHAR2 DEFAULT 'WEEKLY',
p_employee_id
IN employees_employee_id%TYPE,p_salary IN employees_salary%TYPE,
p_bonus_percent
IN OUT NUMBER DEFAULT 1.5, p_margin OUT NUMBER DEFAULT 2,
p_bonus_value
OUT NUMBER)
IS
BEGIN
UPDATE
emp_bonus
SET
bonus_amount =(p_salary * p_bonus_percent)/p_margin
WHERE
employee_id = p_employee_id;
END
set_bonus;
You execute
the CREATE PROCEDURE statement above and notice that it fails. What are two
reasons why
it fails? (Choose two)
A. The syntax
of the UPDATE statement is incorrect.
B. You cannot
update a table using a stored procedure.
C. The format
parameter p_bonus_value is declared but is not used anywhere.
D. The formal
parameter p_cutoff cannot have a DEFAULT clause.
E. The
declaration of the format parameter p_margin cannot have a DEFAULT clause.
F. The
declaration of the format parameter p_bonus_percent cannot have a DEFAULT
clause.
128. Which
three statements are true regarding database triggers? (Choose three)
A. A database
trigger is a PL/SQL block, C, or Java procedure associated with a table, view, schema,
or the database.
B. A database
trigger needs to be executed explicitly whenever a particular event takes place
.
C. A database
trigger executes implicitly whenever a particular event takes place.
D. A database
trigger fires whenever a data event (such as DML) or system event (such as
logon, shutdown) occurs on a schema or database.
E. With a
schema, triggers fire for each event for all users; with a database, triggers
fire for each event for that specific user.
129. A
dependent procedure or function directly or indirectly references one or more
of which four objects? (Choose four)
A. view
B. sequence
C. privilege
D. procedure
E. anonymous
block
F. packaged
procedure or function
130. Examine
this package:
CREATE OR
REPLACE PACKAGE pack_cur
IS
CURSOR c1 IS
SELECT
prodid
FROM product
ORDER BY
Prodid DESC;
PROCEDURE
Proc1;
PROCEDURE
Proc2;
END
pack_cur;
/
CREATE OR
REPLACE PACKAGE BODY pack_cur
IS
v_prodif
NUMBER;
PROCEDURE
proc1 IS
BEGIN
OPEN C1;
LOOP
PROCEDURE
proc2 IS
BEGIN
LOOP
FETCH C1
INTO v_prodid;
DBMS_OUTPUT-PUT_LINE
( ' Row is: ' ll c1 %ROWCOUNT);
EXIT WHEN
C1%ROWCOUNT >= 3;
END LOOP;
END Procl;
/
The product
table has more than 1000 rows. The SQL*Plus SERVEROUTPUT setting is turned
on in your
session.
You execute
the procedure PROC1 from SQL *Plus with the command:
EXECUTE
pack_cur. PROC1;
You then
execute the procedure PROC2 from SQL *Plus with the command:
EXECUTE
pack_cur. PROC2;
What is the
output in your session from the PROC2 procedure?
A. ERROR at
line 1:
B. Row is:
Row is:
Rows is:
C. Row is: 1
Row is: 2
Row is: 3
D. Row is: 4
Row is: 5
Row is: 6
131. You
have the following table:
CREATE TABLE
Emp_log (
Emp_id
NUMBER
Log_date
DATE,
New_salary
NUMBER,
Action
VARCHAR (20));
You have the
following data in the EMPLOYEES table:
EMPLOYEE_ID
LAST_NAME SALARY DEPARTMENT_ID
-----------
------------------- ------------ -------------
100 King
24000 90
101 Kochhar
17000 90
102 De Haan
17000 90
103 Hunold
9000 60
104 Ernst
6000 60
105 Austin
4800 60
106
Pataballa 4800 60
107 Lorentz
4200 60
108
Greenberg 12000 100
201
Hartstein 13000 20
202 Fay 6000
20
You create
this trigger:
CREATE OR
REPLACE TRIGGER Log_salary_increase.
AFTER UPDATE
ON employees
FOR EACH ROW
WHEN
(new.Salary > 1000)
BEGIN
INSERT INTO
Emp_log (Emp_id, Log_date, New_Salary, Action)
VALUES (:
new.Employee_id, SYSDATE, :new.salary, 'NEW SAL' );
END
/
Then, you
enter the following SQL statement:
UPDATE
Employee SET Salary = Salary + 1000.0
Where
Department_id = 20
What are the
result in the EMP_LOG table?
A.
EMP_ID LOG_DATE
NEW_SALARY ACTION
----------
-------- ---------- ----------
201 24-SEP-02
13000 NEW SAL
202 24-SEP-02
600 NEW SAL
B.
EMP_ID LOG_DATE
NEW_SALARY ACTION
----------
-------- ---------- ----------
201 24-SEP-02
14000 NEW SAL
202 24-SEP-02
7000 NEW SAL
C.
EMP_ID LOG_DATE
NEW_SALARY ACTION
----------
-------- ---------- ----------
201 24-SEP-02
NEW SAL
202 24-SEP-02
NEW SAL
D. No rows are
inserted.
132. Examine
this code:
CREATE OR
REPLACE FUNCTION gen_email_name
(p_first
VARCHAR2, p_last VARCHAR2)
RETURN VARCHAR2
IS
v_email_name
VARCHAR (19) ;
BEGIN
v_email_bame
:= SUBSTR(p_first, 1, 1) || SUBSRE(p_last, 1, 7) ||
RETURN
v_email_name;
END
/
Which two
statements are true?(Choose Two)
A. This
function is invalid.
B. This
function can be used against any table.
C. This
function cannot be used in a SELECT statement.
D. This
function can be used only if the two parameters passed in are not bull values.
E. This
function will generate a string based on 2 character values passed into the
function.
F. This
function can be used only on tables where there is a p_first and p_last column.
133. Examine
the code examples. Which one is correct?
A. CREATE OR
REPLACE TRIGGER authorize_action BEFORE INSERT ON EMPLOYEES
CALL
log_exectution; /
B. CREATE OR
REPLACE TRIGGER authorize_action BEFORE EMPLOYEES INSERT
CALL
log_exectution;
C. CREATE OR
REPLACE TRIGGER authorize_action BEFORE EMPLOYEES INSERT
CALL
log_exectution;
D. CREATE OR
REPLACE TRIGGER authorize_action CALL log_exectution; BEFORE INSERT
ON EMPLOYEES; /
134. Which
of the following statements about LOB are true? (Choose Three)
A. LOB is a
database object
B. LOB
represents a data type that is used to store large, unstructured data.
C. LOB can be
stored inside or outside a database.
D. Internal LOB
is a category of LOB.
135. Examine
the following statement:
CREATE OR
REPLACE TRIGGER Check_sal BEFORE UPDATE OF SALARY ON
EMPLOYEES
for each ROW
WHEN
(NEW.salary < OLD. Salary OR NEW.Salary > OLD.salary * 1.2)
BEGIN
RAISE_APPLICATION_ERROR(-20004,’You
cannot increase salary by more than 10% nor
can you
decrease it’);
END;
What will
happen when you execute the statement?
A. the
statement will fail because the OLD and NEW qualifiers are not prefixed with a
colon (:).
B. the
statement will fail because a trigger cannot be defined on a particular column
of a table.
C. The
statement will execute successfully and the trigger will be created.
D. The
statement will execute successfully and the trigger will be created, but the
trigger will fail when the salary column of the Employees table is updated.
136. You
work as an application developer for Dolliver Inc. The company uses an oracle database.
You own subprograms that reference to other subprograms on remote locations. Oracle
server uses the signature mode of remote dependency in order to manage remote dependencies
among the subprograms. Which of the following statements about the signature mode
of dependency are true? (Choose two)
A. Oracle
Server records only the signature for each PL/SQL program unit.
B. Using the signature
mode prevents the unnecessary recompilation of dependent local procedures, as it
allows remote procedures to be recompiled without affecting the dependent local
procedures.
C. Signature
mode is the default mode of remote dependency.
D. Oracle server
records both the timestamp and the signature for each PL/SQL program unit.
137. You
work as an application developer for federal Inc. the company uses an Oracle database.
You have created a function named My_Func in the database. You want to
change the arguments declared for the function. Before changing the arguments
you want to see the names of the procedures and other functions that invoke the
My_Func function. Which of the following data dictionary views will you
query to accomplish this? (choose two)
A.
USER_DB_LINKS
B.
ALL_DEPENDENCIES
C.
USER_DEPENDENCIES
D. USER_SOURCE.
138. You
work as an application developer for federal Inc. the company uses an oracle
database. The database contains a package named G_Comm. You want to remove the
package specification from the database while retaining the package body. Which
of the following statements will you use to accomplish this?
A. DROP Package
G_Comm;
B. DROP Package
Specification G_Comm;
C. DROP Package
Body G_Comm;
D. You cannot
accomplish this;
139. Which
of the following Oracle supplied package is used to enable HTTP callouts from
PL/SQL and
SQL to access data on the Internet?
A. DBMS_DDL
B. UTL_HTTP
C. UTL_SMTP
D. UTL_URL
140. The
DBMS_DDL package provides access from within PL/SQL to:
A. One DDL
B. Two DDL
C. Three DDL
D. Four DDL
141. If
there is any changes applied to the package specification or body of a stored
sub-program which statement is true about it?
A. Package
Specification only requires recompilation
B. Package body
only requires recompilation
C. both package
& body requires recompilation
D. both package
& body does not require recompilation.
142. You
disabled all triggers on the EMPLOYEES table to perform a data load. Now, you
need to enable all triggers on the EMPLOYEES table. Which command accomplished
this?
A. You cannot
enable multiple triggers on a table in one command.
B. ALTER
TRIGGERS ON TABLE employees ENABLE;
C. ALTER
employees ENABLE ALL TRIGGERS;
D. ALTER TABLE
employees ENABLE ALL TRIGGERS;
143. Which
statement is true?
A. Stored
functions can be called from the SELECT and WHERE clauses only.
B. Stored
functions do not permit calculations that involve database links in a
distributed environment.
C. Stored
functions cannot manipulate new types of data, such as longitude and latitude.
D. Stored
functions can increase the efficiency of queries by performing functions in the
query rather than in the application.
144. Examine
this code:
CREATE OR
REPLACE STORED FUNCTION get_sal (p_raise_amt NUMBER, p_employee_id employees.employee_id%TYPE)
RETURN NUMBER
IS
v_salary
NUMBER;
v_raise
NUMBER(8,2);
BEGIN
SELECT
salary
INTO
v_salary
FROM
employees
WHERE
employee_id = p_employee_id;
v_raise :=
p_raise_amt * v_salary;
RETURN
v_raise;
END;
Which
statement is true?
A. This
statement creates a stored procedure named get_sal.
B. This
statement returns a raise amount based on an employee id.
C. This
statement creates a stored function named get_sal with a status of invalid.
D. This
statement creates a stored function named get_sal.
E. This
statement fails.
145. Examine
this code:
CREATE OR REPLACE PACKAGE metric_converter
IS
c_height CONSTRAINT
NUMBER := 2.54;
c_weight
CONSTRAINT NUMBER := .454;
FUNCTION calc_height
(p_height_in_inches NUMBER) RETURN NUMBER;
FUNCTION calc_weight (p_weight_in_pounds
NUMBER) RETURN NUMBER;
END; /
CREATE OR
REPLACE PACKAGE BODY metric_converter
IS
FUNCTION calc_height (p_height_in_inches NUMBER)
RETURN NUMBER
IS
BEGIN
RETURN p_height_in_inches * c_height;
END calc_height;
FUNCTION
calc_weight (p_weight_in_pounds NUMBER) RETURN NUMBER
IS
BEGIN
RETURN
p_weight_in_pounds * c_weight
END calc_weight ;
END
metric_converter; /
CREATE OR
REPLACE FUNCTION calc_height (p_height_in_inches NUMBER) RETURN
NUMBER
IS
BEGIN
RETURN p_height_in_inches
* metric_converter.c_height;
END calc_height; /
Which statement is true?
A. If you
remove the package specification, then the package body and the stand alone
stored function
CALC_HEIGHT are
removed.
B. If you
remove the package body, then the package specification and the stand alone
stored function
CALC_HEIGHT are
removed.
C. If you
remove the package specification, then the package body is removed.
D. If you
remove the package body, then the package specification is removed.
E. If you
remove the stand alone stored function CALC_HEIGHT, then the METRIC_CONVERTER package
body and the package specification are removed.
F. The stand
alone function CALC_HEIGHT cannot be created because its name is used in a
packaged function.
146. You
need to create a DML trigger. Which five pieces need to be identified? (Choose
five)
A. Table
B. DML event
C. Trigger body
D. Package body
E. Package name
F. Trigger name
G. System event.
H. Trigger
timing
147.
Procedure PROCESS_EMP references the table EMP. Procedure UPDATE_EMP updates
rows of table EMP through procedure PROCESS_EMP. There is a remote procedure
QUERY_EMP that queries the EMP table
through the
local procedure PROCESS_EMP. The dependency mode is set to TIMESTAMP in this
session.
Which two
statements are true? (Choose two)
A. If the
signature of procedure PROCESS_EMP is modified and successfully recompiles, the
EMP table is invalidated.
B. If internal
logic of procedure PROCESS_EMP is modified and successfully recompiles, UPDATE_EMP
gets invalidated and will recompile when invoked for the first time.
C. If the
signature of procedure PROCESS_EMP is modified and successfully recompiles, UPDATE_EMP
gets invalidated and will recompile when invoked for the first time.
D. If internal
logic of procedure PROCESS_EMP is modified and successfully recompiles, QUERY_EMP
gets invalidated and will recompile when invoked for the first time.
E. If internal
logic of procedure PROCESS_EMP is modified and successfully recompiles, QUERY_EMP
gets invalidated and will recompile when invoked for the second time.
148. When
using a packaged function in a query, what is true?
A. The COMMIT
and ROLLBACK commands are allowed in the packaged function.
B. You can not
use packaged functions in a query statement.
C. The packaged
function cannot execute an INSERT, UPDATE, or DELETE statement against the table
that is being queried.
D. The packaged
function can execute and INSERT, UPDATE, or DELETE statement against the table
that is being queried if it is used in a subquery.
E. The packaged
function can execute an INSERT, UPDATEM or DELETE statement against the table
that is being queried if the pragma RESTRICT REFERENCE is used.
149. Which
three are true regarding error propagation? (Choose three)
A. An exception
cannot propagate across remote procedure calls.
B. An exception
raised inside a declaration immediately propagates to the current block.
C. The use of
the RAISE; statement in an exception handler reprises the current exception
D. An exception
raised inside an exception handler immediately propagates to the enclosing
block.
2. Before / After
3. Statement / Row level
1. Before
Insert Row level
2. After
Insert Row level
3. Before
Insert statement level
4. After
Insert statement level
5. Before
update Row level
6. After
update Row level
7. Before
update statement level
8. After
update statement level
9. Before Delete Row level
10. After
Delete Row level
11. Before
Delete statement level
12. After
Delete statement level
Syntax to Create a Trigger :
Create or replace trigger <Trg name>
<before/after/instead of> <insert/update/delete>[for each row]
on <Table Name>
begin
Statements
End;
Enabling/Disabling the
triggers:
Alter
trigger <Trg Name> enable/disable;
Dropping the Trigger :
Drop trigger
<Trg Name>
:New Vs
:Old Trigger :
:new.field name -> Used to refer the field value
after updation
:old.fieldname -> Used to refer the field
value before updation
1)create or
replace trigger rest1 before insert or update or delete on emp1
begin
if
to_char(sysdate,'dy')='fri' or to_char(sysdate,'dy')='sun' then
end if
raise_application_error(-20143,'today
is holiday');
end;
2)create or
replace trigger elg1 before insert on emp2 for each row
mths number;
yrs number;
begin
select
months_between(sysdate,:new.dob) into mths from emp2;
yrs :=
round(mths)/12;
if yrs<21
then
raise_application_error(-20345,'the
candiate is not ELIGIBLE ');
end if;
end;
create or
replace trigger inc_rec INSTEAD OF insert on eview
begin
insert into
emp1(empno,sal,basic,dno)values(:new.empno,:new.sal,:new.basic,:new.dno);
insert into
dept1(dno,dname,loc)values(:new.dno,:new.dname,:new.loc);
end;
SQL> Insert Into eview(empno,sal,basic,dno,dname,loc)values(116,4000,2000,222,
2
'production','mumbai');
1
row created.