Reviewed by Editorial Team
The ProProfs editorial team is comprised of experienced subject matter experts. They've collectively created over 10,000 quizzes and lessons, serving over 100 million users. Our team includes in-house content moderators and subject matter experts, as well as a global network of rigorously trained contributors. All adhere to our comprehensive editorial guidelines, ensuring the delivery of high-quality content.
Learn about Our Editorial Process
| By Sourav005
S
Sourav005
Community Contributor
Quizzes Created: 1 | Total Attempts: 1,659
| Attempts: 1,659 | Questions: 96
Please wait...
Question 1 / 96
0 %
0/100
Score 0/100
1. You need to remove the database trigger BUSINESS_HOUR.
Which command do you use to remove the trigger in the SQL *Plus environment?

Explanation

The correct command to remove a trigger in the SQL *Plus environment is "DROP TRIGGER business_hour;". This command will delete the specified trigger from the database.

Submit
Please wait...
About This Quiz
OCA And OCP Exam Quiz! - Quiz

Are you familiar with OCA and OCP? Would you like to try this quiz? OCA stands for Oracle Certified Associate, while OCP stands for Oracle Certification Program. OCA is a beginner’s exam, while OCP is the next step toward certification, and this exam is more in-depth when it comes to... see moreknowledge of technology. If you want to learn more about OCA and OCP, this is the quiz for you.
see less

Personalize your quiz and earn a certificate with your name on it!
2. You create a DML trigger. For the timing information, which are valid with a DML trigger? (Choose all that apply)

Explanation

BEFORE is a valid timing option for a DML trigger. It specifies that the trigger should be executed before the DML operation is performed. This allows the trigger to modify the data before it is inserted, updated, or deleted. DURING, IN PLACE OF, ON SHUTDOWN, and ON STATEMENT EXECUTION are not valid timing options for a DML trigger.

Submit
3. 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?

Explanation

The correct answer is SHOW ERRORS. When creating a function in SQL *Plus, if there are any compilation errors, the message "Warning: Function created with compilation errors" is displayed. To see the actual error message, the command SHOW ERRORS can be issued. This command will provide detailed information about the errors that occurred during the creation of the function.

Submit
4. Which type of argument passes a value from a procedure to the calling environment?

Explanation

The type of argument that passes a value from a procedure to the calling environment is the OUT argument. When a procedure has an OUT argument, it means that the procedure will modify the value of the argument and pass it back to the calling environment. This allows the procedure to return a value or multiple values to the caller.

Submit
5. 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?

Explanation

The correct answer is "ALTER TABLE employees ENABLE ALL TRIGGERS;". This command enables all triggers on the EMPLOYEES table.

Submit
6. 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?

Explanation

To execute the procedure ACCOUNT_TRANSACTION from the SQL Plus prompt, the correct command is EXECUTE ACCOUNT_TRANSACTION. This command will execute the code within the procedure and perform the necessary actions defined in the procedure's body.

Submit
7. 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?

Explanation

Row triggers are the correct chose for solving the problem. A row trigger fires each time the table is affected by the triggering event. If the triggering event affects no rows, a row trigger is not executed. Row triggers are useful if the trigger action depends on data of rows that are affected or on data provided by the triggering event itself. You can create a BEFORE row trigger in order to prevent the triggering operation from succeeding if a certain condition is violated. Within a ROW trigger, reference the value of a column before and after the data change by prefixing it with the OLD and NEW qualifier. Incorrect Answers:
A: Check constaint can't do this job lets take a look:
SQL> ALTER TABLE emp ADD
2 CONSTRAINT ck_sal CHECK (sal BETWEEN sal AND sal*1.1)

3 /
Table altered.
SQL> select ename, sal
2 from emp
3 where ename = 'KING';
ENAME SAL

KING 5000 Now let's issue an update statement SQL> update emp 2 set sal = 10 3 where ename = 'KING'; 1 row updated. As you can see the check constraint can't compare the old value with the new value. D,C: You can use NEW and OLD qualifier with row level triggers, If in the CREATE TRIGGER statement you didn't say FOR EACH ROW then the trigger will be statement level trigger

Submit
8. 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?

Explanation

FOR EACH ROW trigger on the updated table(emp) should be create to record each update row in the AUDIT_TABLE.

Submit
9. 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 ('Cannot delete this player, child records exist in PLAYER_BAT_STAT table');
END;
What prevents this procedure from being created successfully?

Explanation

The procedure cannot be created successfully because the STATS_EXIST_EXCEPTION has not been declared as an exception. In order to use the exception in the EXCEPTION section, it needs to be explicitly declared.

Submit
10. You have a table with the following definition:
CREATE TABLE long_tab
( id NUMBER,
long_col LONG)
You need to convert the LONG_COL column from a LONG data type to a LOB
data type. Which statement accomplish this task?

Explanation

not-available-via-ai

Submit
11. You need to disable all triggers on the EMPLOYEES table.
Which command accomplishes this?

Explanation

The correct answer is "ALTER TABLE employees DISABLE ALL TRIGGERS;". This command specifically targets the EMPLOYEES table and disables all triggers associated with it. The other options are incorrect because they either do not target the table or do not disable all triggers.

Submit
12. 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) 12 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?

Explanation

The correct answer is that the value of DISCOUNT_RATE is set to 0.10 when the package is invoked for the first time in a session. This can be inferred from the code in the package body where DISCOUNT_RATE is assigned the value of 0.10 within the BEGIN-END block. This means that every time the package is invoked for the first time in a session, the value of DISCOUNT_RATE will be set to 0.10.

Submit
13. Which statement is valid when removing procedures?

Explanation

The DROP DROCEDURE statement is used to drop a stand alone procedure Incorrect Answers:
B: You can't drop a procedure that's inside a package, you have to drop the package, and in this case the whole procedures, functions,... that are inside the packages will be droped.
C: Same as B.
D: REUSE SETTINGS is used to to prevent Oracle from dropping and reacquiring compiler switch settings.With this clause, Oracle preserves the existing settings and uses them for the recompilation.

Submit
14. 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?

Explanation

The code creates a trigger named "update_emp" that fires after an update operation on the "emp" table. The trigger inserts a single row into the "audit_table" with the current user and the current date. Therefore, regardless of the number of rows updated in the "emp" table, only one row will be inserted into the "audit_table".

Submit
15. Which two programming constructs can be grouped within a package? (Choose two)

Explanation

Incorrect Answers
C: Triggers are objects that we create are created on the tables.
D: Sequences can't be grouped inside the packages, but we can reference then inside the package.
E: Views are created and they are database objects, and they can't be grouped inside the packages

Submit
16. 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); 6 BEGIN v_email_name := SUBSTR(p_first_name, 1, 1) || SUBSTR(p_last_name, 1, 7) || [email protected] .; UPDATE employees SET email = v_email_name WHERE employee_id = p_id; RETURN v_email_name; END; Which statement removes the function?

Explanation

not-available-via-ai

Submit
17. Examine this package specification:
CREATE OR REPLACE PACKAGE concat_all
IS
v_string VARCHAR2(100);
PROCEDURE combine (p_num_val NUMBER);
PROCEDURE combine (p_date_val DATE);
PROCEDURE combine (p_char_val VARCHAR2, p_num_val NUMBER);
END concat_all;
/
Which overloaded COMBINE procedure declaration can be added to this package specification?

Explanation

The correct answer is "PROCEDURE combine;" because it matches the existing procedure declarations in the package specification. This declaration does not have any parameters, so it can be added as an overloaded version of the combine procedure.

Submit
18. When creating stored procedures and functions, which construct allows you to transfer values to and from the calling environment?

Explanation

When creating stored procedures and functions, the construct that allows you to transfer values to and from the calling environment is arguments. Arguments are parameters that are passed into a procedure or function when it is called. These arguments can be used within the procedure or function to perform operations and return values back to the calling environment.

Submit
19. 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 36 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 = 20M What are the result in the EMP_LOG table?

Explanation

The trigger "Log_salary_increase" is created to insert a new row into the "Emp_log" table whenever there is an update on the "employees" table and the new salary is greater than 1000.0. In the given SQL statement, the condition "Where Department_id = 20M" is incorrect as it should be "Where Department_id = 20". Therefore, the SQL statement will not update any rows in the "employees" table, resulting in no rows being inserted into the "Emp_log" table.

Submit
20. 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?

Explanation

B. You can't call a function in this way, in this way you can call a procedure, because function must return a value, to call a function using EXECUTE command you should declare a bind variable using the VARIABLE command then assign the value returned from the function to this variable, in the following way: SQL> VARIABLE v_get_value NUMBER SQL> EXECUTE :v_get_value := CALC_PLAYER_AVG(31) PL/SQL procedure successfully completed. SQL> PRINT v_get_value V_GET_VALUE
C. Again this way can't be use for calling a function in PL/SQL block because the function return a value and this values must be assigned to PL/SQL variable or to bind variable. Like this DECLARE v_get_from_fn NUMBER; BEGIN v_get_from := CALC_PLAYER_AVG(31); END; 1z0-147 /
D. Same as C.
E. START is use to execute a script

Submit
21. 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,HITS)
VALUES (:NEW.ID, 1997, 0,0);
END;
To which type must you convert the trigger to correct the error?

Explanation

The trigger needs to be converted to a Row trigger in order to correct the error.

Submit
22. Debug the logic in a stored procedure. How do you monitor the value of variables in the procedure using SQL Plus environment?

Explanation

To monitor the value of variables in a stored procedure using SQL Plus environment, you can insert DBMS_OUTPUT.PUT_LINE statement in the code. This statement will display the data on the screen when the stored procedure is executed. By including this statement at various points in the code, you can track the values of variables as the procedure is executed, helping you debug the logic and identify any issues.

Submit
23. Which table should you query to determine when your procedure was last compiled?

Explanation

A. USER_PROCEDURES lists all functions and procedures, along with associated properties. For example, ALL_PROCEDURES indicates whether or not a function is pipelined, parallel enabled or an aggregate function. If a function is pipelined or an aggregate function, the associated implementation type (if any) is
also identified. It doesn't have when the object was last complied.
B. There is nothing called USER_PROCS.
D. There is nothing called USER_PLSQL_UNITS

Submit
24. 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) VALYES(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; ELSIP v_sal < 1000 THEN v_raise := .07; ELSE v_raise := .04; END IF; update_sal(v_raise); END update_emp; 1z0-147 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?

Explanation

not-available-via-ai

Submit
25. 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) VALYES (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;
ELSIP v_sal < 1000 THEN
v_raise : = .07;
ELSE
v_raise : = .04;
FUNCTION calc_tax
END IF;
update_sal (v_raise) ;
END update_emp ;
(p_sal NUMBER)
RETURN NUMBER
IS
BEGIN
RETURN p_sal * tax_rate;
END cale_tax;
END manage_emps;
/
How many public procedures are in the MANAGE_EMPS package?

Explanation

The MANAGE_EMPS package has three public procedures. These procedures are insert_emp, delete_emp, and update_emp. These procedures can be accessed and called by other programs or packages outside of the MANAGE_EMPS package.

Submit
26. 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)

Explanation

A is correct because both of the parameter have a default values.
B is correct because here we call the procedure using position notation, and the first parameter for the procedure will have the value 'Accounting', and since the second parameter has a default value then we can skip it, and in this case it will take the default value.
D is correct because here we are calling the procedure using naming notation, the value 'New York' will go to the parameter p_location, and the parameter p_dept_name will have the default value. The following table list the for passing parameters to a procedure: Incorrect Answer
C: You can't use this way and assume that the PL/SQL will understand that he should assign the default value for the first parameter. This is incorrect way for calling

Submit
27. 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?

Explanation

The USER_DEPENDENCIES dictionary view can be queried to determine the names of the procedures and functions that invoke the CALC_TEAM_AVG function. This view provides information about the dependencies between database objects, including procedures, functions, and packages. By querying this view, you can identify the objects that depend on the CALC_TEAM_AVG function and determine which procedures and functions invoke it.

Submit
28.  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?

Explanation

If you remove the package specification, then the package body is removed. This means that if the package specification is deleted, both the package body and the stand-alone stored function CALC_HEIGHT will be removed as well. The package specification serves as the interface for the package, defining the public elements, while the package body contains the implementation of those elements. Removing the package specification effectively removes the entire package.

Submit
29. A dependent procedure or function directly or indirectly references one or more of which four objects? (Choose four)

Explanation

A dependent procedure or function directly or indirectly references objects such as views, sequences, procedures, and packaged procedures or functions. These objects are related to the dependent procedure or function and are used in its execution or implementation.

Submit
30. Examine the trigger heading: CREATE OR REPLACE TRIGGER salary_check BEFORE UPDATE OF sal, job ON emp FOR EACH ROW Under which condition does this trigger fire?

Explanation

The trigger fires when the value of either the SAL or JOB column in a row is updated in the EMP table. It does not matter if any other columns are updated or if both the SAL and JOB columns are updated together. The trigger will still fire as long as either the SAL or JOB column is updated.

Submit
31. 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?

Explanation

When called from a SELECT statement or a parallelized UPDATE or DELETE statement, the function cannot modify any database tables
When called from an UPDATE, or DELETE statement, the function cannot query or modify any database tables modified by that statement.
When called from a SELECT, INSERT, UPDATE, or DELETE statement, the function cannot execute SQL transaction control statements (such as COMMIT), session control statements (such as SET ROLE), or system control statements (such as ALTER SYSTEM). Also, it cannot execute DDL statements (such as CREATE) because they are followed by an automatic commit.
The function cannot call another subprogram that breaks one of the above restrictions.

Submit
32. 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?

Explanation

When you try to update a salary value in the EMP table, the trigger fails because a SELECT statement on the table being updated is not allowed. In other words, you cannot perform a SELECT operation on the same table that is being updated in a trigger.

Submit
33. An internal LOB is _____.

Explanation

An internal LOB refers to a Large Object that is stored within the database. It can be any type of data such as text, images, or videos that are too large to be stored in a regular table column. Storing the LOB in the database allows for efficient management and retrieval of the data, as it is directly accessible through the database system.

Submit
34. Under which two circumstances do you design database triggers? (Choose two)

Explanation

Database triggers are designed under two circumstances:
1) To guarantee that when a specific operation is performed, related actions are performed. This means that when a certain event or action occurs in the database, the trigger will automatically execute a set of predefined actions or procedures.
2) For centralized, global operations that should be fired for the triggering statement, regardless of which user or application issues the statement. This means that the trigger is designed to execute a specific action or set of actions whenever a particular statement is issued, regardless of who or what issues the statement.

Submit
35. 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)

Explanation

The procedure UPD_BAT_STAT is created with two input parameters, V_ID and V_AB, with default values of 10 and 4 respectively. The procedure updates the AT_BATS column in the PLAYER_BAT_STAT table, adding the value of V_AB to the existing value, for the row where PLAYER_ID matches V_ID. It then commits the changes.

To successfully invoke this procedure in SQL *Plus, the EXECUTE command is used. The first statement, EXECUTE UPD_BAT_STAT;, will invoke the procedure with the default values for V_ID and V_AB. The second statement, EXECUTE UPD_BAT_STAT(V_AB=>10, V_ID=>31);, will invoke the procedure with specific values for V_ID and V_AB.

Submit
36. 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) 1z0-147 / What does this trigger do?

Explanation

The given trigger invokes the procedure audit_action every time a user logs on to the database and adds the username to the audit table. This means that whenever a user logs in, their username will be recorded in the audit table, creating an audit trail of user logins.

Submit
37. Which view displays indirect dependencies, indenting each dependency?

Explanation

The correct answer is IDEPTREE. IDEPTREE view displays indirect dependencies by indenting each dependency. This means that it shows the hierarchical relationship between dependencies, making it easier to understand the dependencies of a particular item.

Submit
38. 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;
DBMS_OUTPUT.PUT_LINE(' There are now ' || a ||
' 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?

Explanation

Removing the "FOR EACH ROW" clause will change the trigger to a statement-level trigger. In a statement-level trigger, the trigger fires once for each SQL statement, rather than for each row affected by the statement. This change will correct the error because the trigger is currently expecting to work with individual rows, but the DELETE statement is affecting multiple rows at once. By making the trigger a statement-level trigger, it will be able to handle the DELETE statement correctly.

Submit
39. When creating a function, in which section will you typically find the RETURN keyword?

Explanation

The RETURN keyword is typically found in the EXECUTABLE section and the HEADER section when creating a function. The EXECUTABLE section contains the code that is executed when the function is called, and the RETURN keyword is used to specify the value that the function will return. The HEADER section contains the function declaration, including the return type of the function. Therefore, both sections are necessary for the presence of the RETURN keyword.

Submit
40. Which two statements about packages are true? (Choose two)

Explanation

Actually theses are some of the advantages of the package, sharing the package among applications and
hide the logic of the procedures and function that are inside the package by declaring them in the package
header and write the code of these procedures and functions inside the package body.
Incorrect Answers:

A: Packages can not be nested
B: Parameters can't be passed to a package; parameters can be passed to procedures and functions only.
C: By the first time you call a procedure, function, or reference a global variable within the package, the whole package will be loaded into the memory and stay there, so when ever you need to reference any of the package's constructs again you will find it in the memory

Submit
41. Given a function CALCTAX: CREATE OR REPLACE FUNCTION calctax (sal NUMBER) RETURN NUMBER IS BEGIN 1z0-147 RETURN (sal * 0.05); END; If you want to run the above function from the SQL *Plus prompt, which statement is true?

Explanation

When you call a function from SQL*PLUS you need to assign the returned value a bind variable, and you need the EXECUTE command to execute the function

Submit
42. Which statement about triggers is true?

Explanation

A database trigger is a stored procedure that automatically executes when a specific event occurs within a database. In this case, the trigger is set to fire when an INSERT statement occurs, meaning that whenever a new record is inserted into the database, the trigger will be activated and execute the specified actions. This allows for automated processes or validations to be performed whenever new data is added to the database.

Submit
43. Examine this procedure:
CREATE OR REPLACE PROCEDURE INSERT_TEAM
(V_ID in NUMBER, V_CITY in VARCHAR2 DEFAULT 'AUSTIN', V_NAME in
VARCHAR2)
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)

Explanation

The procedure INSERT_TEAM has three parameters: V_ID, V_CITY, and V_NAME. The first statement EXECUTE INSERT_TEAM(3, V_NAME=>'LONGHORNS', V_CITY=>'AUSTIN') successfully invokes the procedure by passing the values 3, 'LONGHORNS', and 'AUSTIN' to the respective parameters. The second statement EXECUTE INSERT_TEAM(3, 'AUSTIN','LONGHORNS') also successfully invokes the procedure by passing the values 3, 'AUSTIN', and 'LONGHORNS' to the respective parameters.

Submit
44. Examine this code:
CREATE OR REPLACE PROCEDURE audit_emp
(p_id IN emp_empno%TYPE)
IS
v_id NUMBER;
PROCEDURE log_exec
IS
BEGIN
INSERT INTO log_table (user_id, log_delete)
VALUES (USER, 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 an error when compiled?

Explanation

The code causes an error when compiled because the variable v_name is referenced before it is declared. In the code, the LOG_EXEC procedure is invoked before the declaration of v_name, causing the error. To fix this, the variable v_name should be declared before declaring the LOG_EXEC procedure.

Submit
45. Examine this package:
CREATE OR REPLACE PACKAGE pack_cur
IS
CURSOR c1 IS
SELECT prodid
FROM poduct
ORDER BY prodid DESC;
PROCEDURE proc1;
PROCEDURE proc2;
END pack_cur;
/
CREATE OR REPLACE PACKAGE BODY pack_cur
IS
v_prodid NUMBER;
PROCEDURE proc1 IS
BEGIN
OPEN C1
LOOP
FETCH C1 INTO v_prodid;
DBMS_OUTPUT.PUT_LINE ( 'Row is: '| | c1%ROWCOUNT);
EXIT WHEN c1%ROWCONT >= 3;
END LOOP; 
END procl;
PROCEDURE proc2 IS
BEGIN
LOOP
FETCH C1 INTO v_prodid;
DBMS_OUTPUT.PUT_LINE ( 'Row is: '| | c1%ROWCOUNT);
EXIT WHEN c1%ROWCONT >= 6;
END LOOP; 
CLOSE C1;

END proc2;
END pack_cur;
/
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
What is the output in your session?

Explanation

not-available-via-ai

Submit
46. Which one is the correct routine for the utilization order when using dynamic SQL?

Explanation

The correct routine for the utilization order when using dynamic SQL is to first open the connection, then parse the SQL statement, bind the variables, execute the statement, fetch the results, and finally close the connection. This order ensures that the connection is established before processing the SQL statement, and that the necessary variables are bound and results are fetched in the correct order.

Submit
47. 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;
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?

Explanation

You can greatly simplify dependency management with packages when referencing a package procedure or function from a stand-alone procedure or function.
If the package body changes and the package specification does not change, the stand-alone procedure referencing a package construct remains valid.
If the package specification changes, the outside procedure referencing a package construct is invalidated, as is the package body

Submit
48. A CALL statement inside the trigger body enables you to call ______.

Explanation

A. Package can't be called, we call a procedure inside the package.
B. We can't call a function use CALL statement because function must return a value.
D. Trigger can't be called, they are execute automatically when the trigger event occur.

Submit
49. Which two statements describe the state of a package variable after executing the package in which it is declared? (Choose two)

Explanation

You can keep track of the state of a package variable or cursor, which persists throughout the user session,
from the time the user first references the variable or cursor to the time the user disconnects.

1 Initialize the variable within its declaration or within an automatic, one-time-only procedure.
2 Change the value of the variable by means of package procedures.
3 The value of the variable is released when the user disconnects. Incorrect Answers

B: Each session will have its own value for the variables
C: It persists across the transactions and through the user session.
D: Each user has his own values and results, because each user has his own users.

Submit
50. What part of a database trigger determines the number of times the trigger body executes?

Explanation

The correct answer is "Trigger type". The trigger type determines the number of times the trigger body executes. Different trigger types have different behaviors when it comes to execution, such as being fired once per statement, once per row, or once per transaction. Therefore, the trigger type is crucial in determining how many times the trigger body will be executed.

Submit
51. Examine this package:
CREATE OR REPLACE PACKAGE discounts
IS
g_id NUMBER := 7829;
discount_rate NUMBER := 0.00;
PROCEDURE display_price (p_price NUMBER);
END discounts;
/
CREATE OR REPLACE PACKAGE BODY discounts
IS
PROCEDURE display_price (p_price NUMBER)
IS
BEGIN
DBMS_OUTPUT.PUT_LINE('Discounted '||
TO_CHAR(p_price*NVL(discount_rate, 1)));

END display_price;
BEGIN
discount_rate := 0.10;
END discounts;
/
Which statement is true?

Explanation

A one-time-only procedure is executed only once, when the package is first invoked within the user session

Submit
52. Which two statements about packages are true? (Choose two)

Explanation

The package specification is required because it contains the declaration of the package, including its public variables, constants, types, exceptions, and subprograms. On the other hand, the package body is optional because it contains the implementation of the package, including the code for the subprograms declared in the specification.

The specification and body of the package are stored separately in the database to allow for modularity and reusability. This means that the package specification can be compiled and stored in the database without the need for the package body, allowing other programs to reference and use the package's public components. The package body can then be compiled and stored separately, providing the implementation details for the package.

Submit
53. Examine this code:
CREATE OR REPLACE PACKAGE comm_package
1z0-147
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?

Explanation

not-available-via-ai

Submit
54. Examine this code:
CREATE OR REPLACE FUNCTION calc_sal(p_salary NUMBER)
RETURN NUMBER
IS
v_raise NUMBER(4,2) DEFAULT 1.08;
BEGIN
RETURN v_raise * p_salary;
END calc_sal;
/
Which statement accurately call the stored function CALC_SAL? (Choose two)

Explanation

The two statements that accurately call the stored function CALC_SAL are the SELECT statements. The first SELECT statement selects the salary and the calculated salary using the CALC_SAL function for all employees in the department with ID 60. The second SELECT statement selects the last name, salary, and calculated salary using the CALC_SAL function for all employees and orders them by the calculated salary.

Submit
55. What happens during the execute phase with dynamic SQL for INSERT, UPDATE, and DELETE operations?

Explanation

All SQL statements have to go through various stages. Some stages may be skipped.

1 Parse Every SQL statement must be parsed. Parsing the statement includes checking the statement's syntax and validating the statement, ensuring that all references to objects are correct, and ensuring that the relevant privileges to those objects exist.
2 Bind
After parsing, the Oracle server knows the meaning of the Oracle statement but still may not have enough
information to execute the statement. The Oracle server may need values for any bind variable in the
statement. The process of obtaining these values is called binding variables.

3 Execute
At this point, the Oracle server has all necessary information and resources, and the statement is executed.

4 Fetch
In the fetch stage, rows are selected and ordered (if requested by the query), and each successive fetch
retrieves another row of the result, until the last row has been fetched. You can fetch queries, but not the
DML statements.

Submit
56. 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?

Explanation

The procedure will first look in the owner of the procedure schema before looking for the public synonym.

Submit
57. What can you do with the DBMS_LOB package?

Explanation

A. DBMS_LOB.WRITE is used to write to Internal LOBs.
The internal LOB is stored inside the Oracle server. A BLOB, NCLOB, or CLOB can be one of the
following:

An attribute of a user-defined type

A column in a table

A bind or host variable

A PL/SQL variable, parameter, or result
Internal LOBs can take advantage of Oracle features such as:

Concurrency mechanisms

Redo logging and recovery mechanisms

Transactions with commit or rollbacks

BFILENAME is a built-in function that initializes a BFILE column to point to an external file. Use the
BFILENAME function as part of an INSERT statement to initialize a BFILE column by associating it with a


physical file in the server file system. You can use the UPDATE statement to change the reference target of the BFILE. A BFILE can be initialized to NULL and updated later by using the BFILENAME function.
C. DBMS_LOB.FILEEXISTS function to find if the file exits on the server

Submit
58. Which two program declarations are correct for a stored program unit? (Choose two)

Explanation

The two program declarations that are correct for a stored program unit are:

1. CREATE OR REPLACE FUNCTION tax_amt (p_id NUMBER) RETURN NUMBER
This declaration creates a function named tax_amt that takes in a parameter p_id of type NUMBER and returns a value of type NUMBER.

2. CREATE OR REPLACE PROCEDURE tax_amt (p_id NUMBER, p_amount OUT NUMBER)
This declaration creates a procedure named tax_amt that takes in two parameters - p_id of type NUMBER and p_amount of type OUT NUMBER. The OUT keyword indicates that the p_amount parameter is an output parameter.

These two declarations are correct because they follow the syntax rules for creating a function and a procedure in a stored program unit.

Submit
59. Examine this code:
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)

Explanation

not-available-via-ai

Submit
60. Which Oracle supply package allows you to run jobs at use defined times?

Explanation

The correct answer is DBMS_JOB. DBMS_JOB is an Oracle supply package that allows users to schedule and run jobs at specific times. It provides a mechanism for creating, managing, and executing jobs within the database. With DBMS_JOB, users can define the frequency and timing of job execution, making it a useful tool for automating tasks and processes in Oracle databases.

Submit
61. Which four triggering events can cause a trigger to fire? (Choose four)

Explanation

The four triggering events that can cause a trigger to fire are:
1) A specific error or any errors occurs - This means that when a specific error or any error occurs, the trigger will be triggered.
2) A database is shut down or started up - When the database is shut down or started up, the trigger will be fired.
3) A specific user or any user logs on or off - Whenever a specific user or any user logs on or off, the trigger will be triggered.
4) A user executes a CREATE or an ALTER table statement - If a user executes a CREATE or ALTER table statement, the trigger will fire.

Submit
62. Which two tables or views track object dependencies? (Choose two)

Explanation

The two tables or views that track object dependencies are USER_DEPENDENCIES and IDEPTREE. USER_DEPENDENCIES table stores information about dependencies between objects in the database, such as tables, views, procedures, etc. IDEPTREE view provides a hierarchical representation of object dependencies, allowing users to easily understand the relationships between different objects.

Submit
63. 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 APD_BAT_STAT procedure and pass a parameter.
Which statement, when added to the above procedure will successfully invoke the UPD_BAT_STAT
procedure?

Explanation

The correct statement to successfully invoke the UPD_BAT_STAT procedure is UPD_BAT_STAT(V_ID). This statement calls the UPD_BAT_STAT procedure and passes the parameter V_ID to it.

Submit
64. 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?

Explanation

A local subprogram defined within the program unit ORDERTOTAL is the most appropriate location to store the code that calculates the discounts. This ensures that the code is easily accessible and can be invoked from within the program unit ORDERTOTAL, as required. Storing it as a local subprogram also keeps the code organized and encapsulated within the program unit, making it easier to maintain and understand. Additionally, using a local subprogram allows for better code reusability within the program unit ORDERTOTAL.

Submit
65. Examine this package: CREATE OR REPLACE PACKAGE BB_PACK APPEND Append the contents of the source LOB to the destination LOB COPY Copy all or part of the source LOB to the destination LOB ERASE Erase all or part of a LOB LOADFROMFILE Load BFILE data into an internal LOB TRIM Trim the LOB value to a specified shorter length WRITE Write data to the LOB from a specified offset GETLENGTH Get the length of the LOB value INSTR Return the matching position of the nth occurrence of the pattern in the LOB READ Read data from the LOB starting at the specified offset SUBSTR Return part of the LOB value starting at the specified offset FILECLOSE Close the file FILECLOSEALL Close all previously opened files FILEEXISTS Check if the file exists on the server FILEGETNAME Get the directory alias and file name FILEISOPEN Check if the file was opened using the input BFILE locators FILEOPEN Open a file 1z0-147 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?

Explanation

not-available-via-ai

Submit
66. Which command must you issue to allow users to access the UPD_TEAM_STAT trigger on the TEAM table?

Explanation

The correct answer is "GRANT SELECT, INSERT, UPDATE, DELETE ON TEAM TO PUBLIC". This command grants the SELECT, INSERT, UPDATE, and DELETE privileges on the TEAM table to all users in the PUBLIC role. This means that any user will be able to access and perform these actions on the TEAM table, including triggering the UPD_TEAM_STAT trigger if it is set up to be triggered by these actions.

Submit
67. Which three are valid ways to minimize dependency failure? (Choose three)

Explanation

not-available-via-ai

Submit
68. Examine this code:
CREATE OR REPLACE STORED FUNCTION get_sal
(p_raise_amt NUMBER, p_employee_id employees.employee_id%TYPE)
RETURN NUMBER
1z0-147
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?

Explanation

The given code is incorrect and will fail. The function declaration is missing the keyword "FUNCTION" after the return type declaration. The correct syntax should be "CREATE OR REPLACE FUNCTION get_sal (p_raise_amt NUMBER, p_employee_id employees.employee_id%TYPE) RETURN NUMBER IS". Without this keyword, the code will fail to compile.

Submit
69. What is a condition predicate in a DML trigger?

Explanation

A conditional predicate in a DML trigger allows you to combine several DBM triggering events into one in the trigger body. This means that you can specify multiple conditions or events that will trigger the execution of the trigger, making it more flexible and versatile.

Submit
70. Why do we use INSTEAD OF trigger?

Explanation

An INSTEAD OF trigger is used to modify data in an inherently non-updatable view when a DML statement is issued against it. This is because views are virtual tables that do not store data physically, so they cannot be directly updated. By using an INSTEAD OF trigger, we can define the logic to modify the underlying tables when an update is attempted on the view, allowing us to effectively modify the data in the view indirectly.

Submit
71. 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 TIMESTAMP.
What happens when procedure A is invoked at 1 P.M?

Explanation

When the local procedure is invoked, at run time the Oracle server compares the two time stamps of the referenced remote procedure. If the time stamps are equal (indicating that the remote procedure has not recompiled), the Oracle server executes the local procedure. If the time stamps are not equal (indicating that the remote procedure has recompiled), the Oracle server invalidates the local procedure and returns a runtime error. If the local procedure, which is now tagged as invalid, is invoked a second time, the Oracle server recompiles it before executing, in accordance with the automatic local dependency mechanism. So if a local procedure returns a run-time error the first time that it is invoked, indicating that the remote procedure's time stamp has changed, you should develop a strategy to re-invoke the local procedure.

Submit
72. Examine this package body: CREATE OR REPLACE PACKAGE BODY forward_pack IS V_sum NUMBER; - 44 - PROCEDURE calc_ord(. . . ); PROCEDURE generate_summary(. . . ) IS BEGIN Calc_ord(. . . ); . . . END calc_ord; END forward_pack; / Which construct has a forward declaration?

Explanation

The construct that has a forward declaration in the given package body is CALC_ORD. This is because the procedure CALC_ORD is declared before it is defined or implemented in the package body. The forward declaration allows the package body to reference and call the procedure before it is fully defined, which can be useful in certain scenarios where procedures need to call each other in a specific order.

Submit
73. Which two describe a stored procedure? (Choose two)

Explanation

A procedure is a named PL/SQL block that can accept parameters (sometimes referred to as arguments), and be invoked. Generally speaking, you use a procedure to perform an action. A procedure has a header, a declaration section, an executable section, and an optional exception-handling section. A procedure can be compiled and stored in the database as a schema object. Procedures promote reusability and maintainability. When validated, they can be used in any number of applications. If the requirements change, only the procedure needs to be updated.

Submit
74. When using a packaged function in a query, what is true?

Explanation

not-available-via-ai

Submit
75. Which two dopes the INSTEAD OF clause in a trigger identify? (Choose two)

Explanation

not-available-via-ai

Submit
76. Which two dictionary views track dependencies? (Choose two)

Explanation

The two dictionary views that track dependencies are DEPTREE_TEMPTAB and USER_DEPENDENCIES. DEPTREE_TEMPTAB is a temporary table that is created during the analysis of dependencies in the database. It stores information about the dependencies between objects. USER_DEPENDENCIES is a view that shows the dependencies between objects owned by the current user. It provides information about the objects that depend on a particular object and the objects that the particular object depends on.

Submit
77. 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?

Explanation

The correct answer is "You cannot accomplish this" because in Oracle, it is not possible to drop just the package specification while retaining the package body. When you drop a package, both the specification and body are dropped together. If you want to remove the package specification while keeping the package body, you would need to recreate the package without the specification.

Submit
78. 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 the EMPLOYEES table only during business hours.'); END IF; END; / What type of trigger is it?

Explanation

As you can see there is nothing called BEFORE LOGON

Submit
79. Which script file must be executed before you can determine indirect independence’s using the DEPTREE AND IDEPTREE VIEWS?

Explanation

The script file that needs to be executed before determining indirect independence using the DEPTREE and IDEPTREE views is UTLDTREE.SQL.

Submit
80. Which compiler directive to check the purity level of functions?

Explanation

The correct answer is PRAGMA RESTRICT_REFERRENCES. This compiler directive is used to check the purity level of functions. Purity level refers to the side effects that a function may have, such as modifying global variables or performing I/O operations. By using this pragma, the compiler can enforce restrictions on the functions to ensure they have a certain level of purity, which can help improve code reliability and maintainability.

Submit
81. Which statements are true? (Choose all that apply)

Explanation

The given answer is correct. If errors occur during the compilation of a trigger, the trigger is still created. This means that even if there are compilation errors, the trigger will still be created in the database. Additionally, you can use the SHOW ERRORS command within iSQL *Plus to see the compilation errors. This command allows you to view the specific errors that occurred during the compilation process. Another option is to go into SQL *Plus and query the USER_ERRORS data dictionary view. This view provides information on the compilation errors for all triggers in the current user's schema.

Submit
82. 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)

Explanation

not-available-via-ai

Submit
83. All users currently have the INSERT privilege on the PLAYER table. You only want your users to insert into this table using the ADD_PLAYTER procedure. Which two actions must you take? (Choose two)

Explanation

To ensure that users can only insert into the PLAYER table using the ADD_PLAYER procedure, two actions must be taken. First, the privilege to execute the ADD_PLAYER procedure should be granted to the public using the command "GRANT EXECUTE ON ADD_PLAYER TO PUBLIC". This allows all users to execute the procedure. Second, the privilege to directly insert into the PLAYER table should be revoked from the public using the command "REVOKE INSERT ON PLAYER FROM PUBLIC". This prevents users from directly inserting into the table and ensures that they can only insert through the ADD_PLAYER procedure.

Submit
84. Which three statements are true regarding database triggers? (Choose three)

Explanation

The given answer states that a database trigger is a PL/SQL block, C, or Java procedure associated with a table, view, schema, or the database. This means that triggers can be written in different programming languages and can be associated with various database objects. The answer also mentions that a database trigger executes implicitly whenever a particular event takes place. This means that triggers are automatically executed when a specific event occurs, without the need for explicit execution. Lastly, the answer states that triggers fire whenever a data event or system event occurs on a schema or database. This means that triggers can be triggered by actions such as data manipulation or system events like logon or shutdown.

Submit
85. You have an AFTER UPDATE row-level on the table EMP. The trigger queries the EMP table and inserts the updating user's information into the AUDIT_TABLE. What happens when the user updates rows on the EMP table?

Explanation

When the user updates rows on the EMP table, a runtime error occurs. As a result of this error, both the effect of the trigger body and the triggering statement are rolled back. This means that any changes made by the trigger and the update on the EMP table are undone, ensuring data integrity.

Submit
86. 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?

Explanation

To send a message to another session connected to the same instance in Oracle, you would use the DBMS_PIPES package. This package provides procedures and functions to create named pipes that can be used for inter-session communication within the same instance. By using DBMS_PIPES, you can send messages from one session to another, allowing for communication and coordination between different sessions in the Oracle database.

Submit
87. To be callable from a SQL expression, a user-defined function must do what?

Explanation

A user-defined function must be stored only in the database in order to be callable from a SQL expression. This means that the function should be created and stored within the database system, rather than being defined and stored outside of it. By being stored in the database, the function becomes accessible and can be invoked within SQL queries and expressions.

Submit
88. Which three are true regarding error propagation? (Choose three)

Explanation

An exception cannot propagate across remote procedure calls because exceptions are not transmitted across network boundaries. The use of the RAISE; statement in an exception handler reprises the current exception, meaning that it allows the current exception to be re-raised. An exception raised inside an exception handler immediately propagates to the enclosing block, meaning that if an exception is raised within an exception handler, it will continue to propagate to the next higher level in the program until it is caught or reaches the top level.

Submit
89. Which code successfully calculates tax?

Explanation

This code successfully calculates tax because it defines a function called "calctax" with a parameter "p_no" of type NUMBER and a return type of NUMBER. It declares variables "v_sal" and "tax" of type NUMBER. It uses a SELECT statement to retrieve the salary of an employee with the given employee number and assigns it to "v_sal". It then calculates the tax by multiplying "v_sal" with 0.05 and assigns it to "tax". Finally, it returns the calculated tax.

Submit
90. 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)

Explanation

The signature mode of dependency in Oracle Server records both the timestamp and the signature for each PL/SQL program unit. This means that when a remote procedure is recompiled, it does not affect the dependent local procedures, preventing unnecessary recompilation of those procedures. The statement that using the signature mode prevents unnecessary recompilation of dependent local procedures is also true, as explained above.

Submit
91. If there is any changes applied to the package specification or body of a stored sub-program which statement is true about it?

Explanation

When changes are made to the package specification or body of a stored sub-program, only the package specification requires recompilation. This is because the package specification defines the interface of the package, including the public procedures and functions that can be called from outside the package. The package body, on the other hand, contains the implementation details of the package and does not need to be recompiled unless there are changes to the package specification.

Submit
92. Procedure PROCESS_EMP references the table EMP.
Procedure UPDATE_EMP updates rows if 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)

Explanation

not-available-via-ai

Submit
93. 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)

Explanation

To accomplish the task of finding the names of the procedures and other functions that invoke the My_Func function, you would query the ALL_DEPENDENCIES and USER_DEPENDENCIES data dictionary views. These views provide information about the dependencies between database objects, including procedures and functions. By querying these views, you can identify the objects that depend on the My_Func function and determine which procedures and functions need to be updated if you change the arguments declared for My_Func. The USER_SOURCE view, on the other hand, provides the source code for stored procedures, functions, and other objects, but it does not provide information about dependencies. The USER_DB_LINKS view is not relevant to this task, as it provides information about database links, not dependencies between objects.

Submit
94. 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?

Explanation

The given code is a function that takes two VARCHAR2 parameters, p_first and p_last, and returns a VARCHAR2 value. It concatenates the first character of p_first, the first seven characters of p_last, and returns the result as v_email_name. Therefore, the correct answer is "This function will generate a string based on 2 character values passed into the function."

Submit
95. Examine the code examples. Which one is correct?

Explanation

not-available-via-ai

Submit
96. You need to create a DML trigger. Which five pieces need to be identified? (Choose five)

Explanation

not-available-via-ai

Submit
View My Results

Quiz Review Timeline (Updated): Mar 21, 2023 +

Our quizzes are rigorously reviewed, monitored and continuously updated by our expert board to maintain accuracy, relevance, and timeliness.

  • Current Version
  • Mar 21, 2023
    Quiz Edited by
    ProProfs Editorial Team
  • Dec 26, 2008
    Quiz Created by
    Sourav005
Cancel
  • All
    All (96)
  • Unanswered
    Unanswered ()
  • Answered
    Answered ()
You need to remove the database trigger BUSINESS_HOUR. Which command...
You create a DML trigger. For the timing information, which are valid...
When creating a function in SQL *Plus, you receive this message:...
Which type of argument passes a value from a procedure to the calling...
You disabled all triggers on the EMPLOYEES table to perform a data...
Given the header of a procedure ACCOUNT_TRANSACTION:CREATE OR ...
Which code can you use to ensure that the salary is not increased by...
You need to create a trigger on the EMP table that monitors every row...
Examine this procedure: CREATE OR REPLACE PROCEDURE DELETE_PLAYER...
You have a table with the following definition:CREATE TABLE long_tab (...
You need to disable all triggers on the EMPLOYEES table. Which command...
CREATE OR REPLACE PACKAGE discounts IS ...
Which statement is valid when removing procedures?
Examine this code: CREATE OR REPLACE TRIGGER update_emp AFTER UPDATE...
Which two programming constructs can be grouped within a package?...
Examine this code: ...
Examine this package specification:CREATE OR REPLACE PACKAGE...
When creating stored procedures and functions, which construct allows...
You have the following table: ...
Examine this function: CREATE OR REPLACE FUNCTION CALC_PLAYER_AVG...
This statement fails when executed: ...
Debug the logic in a stored procedure. How do you monitor the value of...
Which table should you query to determine when your procedure was last...
Examine this package: CREATE OR REPLACE PACKAGE manage_emps IS...
Examine this package: CREATE OR REPLACE PACKAGE manage_emps IS...
Examine this code: CREATE OR REPLACE PRODECURE add_dept (p_dept_name...
You are about to change the arguments of the CALC_TEAM_AVG function....
 Examine this code: CREATE OR REPLACE PACKAGE metric_converter IS...
A dependent procedure or function directly or indirectly references...
Examine the trigger heading: CREATE OR REPLACE TRIGGER salary_check...
Examine this code: CREATE OR REPLACE FUNCTION...
You have a row level BEFORE UPDATE trigger on the EMP table. This...
An internal LOB is _____.
Under which two circumstances do you design database triggers? (Choose...
Examine this procedure: CREATE OR REPLACE PROCEDURE UPD_BAT_STAT (V_ID...
Examine this code: CREATE OR REPLACE PROCEDURE audit_action ...
Which view displays indirect dependencies, indenting each dependency?
Examine the trigger: CREATE OR REPLACE TRIGGER Emp_count AFTER DELETE...
When creating a function, in which section will you typically find the...
Which two statements about packages are true? (Choose two)
Given a function CALCTAX: CREATE OR REPLACE FUNCTION calctax (sal...
Which statement about triggers is true?
Examine this procedure: CREATE OR REPLACE PROCEDURE INSERT_TEAM(V_ID...
Examine this code: CREATE OR REPLACE PROCEDURE audit_emp (p_id IN...
Examine this package: CREATE OR REPLACE PACKAGE pack_cur IS CURSOR c1...
Which one is the correct routine for the utilization order when using...
Examine this package: CREATE OR REPLACE PACKAGE BB_PACK IS...
A CALL statement inside the trigger body enables you to call ______.
Which two statements describe the state of a package variable after...
What part of a database trigger determines the number of times the...
Examine this package: CREATE OR REPLACE PACKAGE discounts IS g_id...
Which two statements about packages are true? (Choose two)
Examine this code: CREATE OR REPLACE PACKAGE comm_package 1z0-147 IS...
Examine this code: CREATE OR REPLACE FUNCTION calc_sal(p_salary...
What happens during the execute phase with dynamic SQL for INSERT,...
There is a CUSTOMER table in a schema that has a public synonym...
What can you do with the DBMS_LOB package?
Which two program declarations are correct for a stored program unit?...
Examine this code: CREATE OR REPLACE PROCEDURE set_bonus (p_cutoff IN...
Which Oracle supply package allows you to run jobs at use defined...
Which four triggering events can cause a trigger to fire? (Choose...
Which two tables or views track object dependencies? (Choose two)
Examine this procedure: CREATE OR REPLACE PROCEDURE ADD_PLAYER (V_ID...
You want to create a PL/SQL block of code that calculates discounts on...
Examine this package: CREATE OR REPLACE PACKAGE BB_PACK APPEND Append...
Which command must you issue to allow users to access the...
Which three are valid ways to minimize dependency failure? (Choose...
Examine this code: CREATE OR REPLACE STORED FUNCTION get_sal...
What is a condition predicate in a DML trigger?
Why do we use INSTEAD OF trigger?
Local procedure A calls remote procedure B. Procedure B was compiled...
Examine this package body: ...
Which two describe a stored procedure? (Choose two)
When using a packaged function in a query, what is true?
Which two dopes the INSTEAD OF clause in a trigger identify? (Choose...
Which two dictionary views track dependencies? (Choose two)
You work as an application developer for federal Inc. the company uses...
Examine this code: CREATE OR REPLACE TRIGGER secure_emp BEFORE LOGON...
Which script file must be executed before you can determine indirect...
Which compiler directive to check the purity level of functions?
Which statements are true? (Choose all that apply)
Examine this code: CREATE OR REPLACE PROCEDURE add_dept ( p_name...
All users currently have the INSERT privilege on the PLAYER table. You...
Which three statements are true regarding database triggers? (Choose...
You have an AFTER UPDATE row-level on the table EMP. The trigger...
You want to send a message to another session connected to the same...
To be callable from a SQL expression, a user-defined function must do...
Which three are true regarding error propagation? (Choose three)
Which code successfully calculates tax?
You work as an application developer for Dolliver Inc. The company...
If there is any changes applied to the package specification or body...
Procedure PROCESS_EMP references the table EMP. Procedure UPDATE_EMP...
You work as an application developer for federal Inc. the company uses...
Examine this code: CREATE OR REPLACE FUNCTION gen_email_name(p_first...
Examine the code examples. Which one is correct?
You need to create a DML trigger. Which five pieces need to be...
Alert!

Advertisement