OCA And OCP Exam Quiz!

Approved & Edited by ProProfs Editorial Team
The editorial team at ProProfs Quizzes consists of a select group of subject experts, trivia writers, and quiz masters who have authored over 10,000 quizzes taken by more than 100 million users. This team includes our in-house seasoned quiz moderators and subject matter experts. Our editorial experts, spread across the world, are rigorously trained using our comprehensive guidelines to ensure that you receive the highest quality quizzes.
Learn about Our Editorial Process
| By Sourav005
S
Sourav005
Community Contributor
Quizzes Created: 1 | Total Attempts: 1,643
Questions: 96 | Attempts: 1,643

SettingsSettingsSettings
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 knowledge of technology. If you want to learn more about OCA and OCP, this is the quiz for you.


Questions and Answers
  • 1. 

    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)

    Correct Answer
    A. SELECT CALC_PLAYER_AVG(PLAYER_ID) FROM PLAYER_BAT_STAT;
    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

    Rate this question:

  • 2. 

    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');

    Correct Answer(s)
    A. Add_dept;
    B. Add_dept('Accounting');
    D. Add_dept(p_location=>'New York');
    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

    Rate this question:

  • 3. 

    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

    Correct Answer(s)
    D. The contents of packages can be shared by many applications.
    E. You can achieve information hiding by making package constructs private
    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

    Rate this question:

  • 4. 

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

    • A.

      Cursor

    • B.

      Constant

    • C.

      Trigger

    • D.

      Sequence

    • E.

      View

    Correct Answer(s)
    A. Cursor
    B. Constant
    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

    Rate this question:

  • 5. 

    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.

    Correct Answer(s)
    A. It persists across transactions within a session.
    E. It does not persist from session to session for the same user.
    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.

    Rate this question:

  • 6. 

    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;

    Correct Answer
    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;
    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

    Rate this question:

  • 7. 

    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 the package 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.

    Correct Answer
    A. Use a drop procedure statement to drop a standalone procedure.
    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.

    Rate this question:

  • 8. 

    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_HITSWHERE 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

    Correct Answer
    B. VALIDATE_PLAYER_STAT is not invalidated
    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

    Rate this question:

  • 9. 

    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.

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

    Rate this question:

  • 10. 

    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.

    Correct Answer(s)
    A. If errors occur during the compilation of a trigger, the trigger is still created.
    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.
    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.

    Rate this question:

  • 11. 

    Which two dictionary views track dependencies? (Choose two)

    • A.

      USER_SOURCE

    • B.

      UTL_DEPTREE

    • C.

      USER_OBJECTS /DBA_DEPENDENT_OBJECTS

    • D.

      DEPTREE_TEMPTAB

    • E.

      USER_DEPENDENCIES

    Correct Answer(s)
    D. DEPTREE_TEMPTAB
    E. USER_DEPENDENCIES
    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.

    Rate this question:

  • 12. 

    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?

    • A.

      You need to execute the command CALCTAX(1000);.

    • B.

      You need to execute the command EXECUTE FUNCTION calctax;.

    • 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);

    Correct Answer
    E. You need to create a SQL *Plus environment variable X and issue the command EXECUTE :X := CALCTAX(1000);
    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

    Rate this question:

  • 13. 

    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

    Correct Answer
    D. The SQL statement is run and the number of rows processed is returned.
    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.

    Rate this question:

  • 14. 

    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

    Correct Answer
    A. Trigger type
    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.

    Rate this question:

  • 15. 

    Examine this code: CREATE OR REPLACE FUNCTION gen_email_name(p_first_name VARCHAR2, p_last_name VARCHAR2, p_id NUMBER) RETURN VARCHAR2is 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_nameWHERE employee_id = p_id; RETURN v_email_name; END; You run this SELECT statement: SELECT first_name, last_namegen_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

    Correct Answer
    B. The statement fails because functions called from SQL expressions cannot perform DML.
    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.

    Rate this question:

  • 16. 

    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

    Correct Answer
    C. USER_OBJECTS
    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

    Rate this question:

  • 17. 

    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?

    • A.

      DML trigger

    • B.

      INSTEAD OF trigger

    • C.

      Application trigger

    • D.

      System event trigger

    • E.

      This is an invalid trigger

    Correct Answer
    E. This is an invalid trigger
    Explanation
    As you can see there is nothing called BEFORE LOGON

    Rate this question:

  • 18. 

    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?

    • A.

      The value of DISCOUNT_RATE always remains 0.00 in a session.

    • B.

      The value of DISCOUNT_RATE is set to 0.10 each time the package is invoked in a session.

    • C.

      The value of DISCOUNT_RATE is set to 1.00 each time the procedure DISPLAY_PRICE is invoked. 1z0-147

    • D.

      The value of DISCOUNT_RATE is set to 0.10 when the package is invoked for the first time in a session.

    Correct Answer
    D. The value of DISCOUNT_RATE is set to 0.10 when the package is invoked for the first time in a session.
    Explanation
    A one-time-only procedure is executed only once, when the package is first invoked within the user session

    Rate this question:

  • 19. 

    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

    Correct Answer
    A. 1
    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".

    Rate this question:

  • 20. 

    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. 1z0-147

    • 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.

    Correct Answer
    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.
    Explanation
    The procedure will first look in the owner of the procedure schema before looking for the public synonym.

    Rate this question:

  • 21. 

    Which two statements about packages are true? (Choose two)

    • A.

      Both the specification and body are required components of a package.

    • B.

      The package specification is optional, but the package body is required

    • C.

      The package specification is required, but the package body is optional.

    • D.

      The specification and body of the package are stored together in the database

    • E.

      The specification and body of the package are stored separately in the database.

    Correct Answer(s)
    C. The package specification is required, but the package body is optional.
    E. The specification and body of the package are stored separately in the database.
    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.

    Rate this question:

  • 22. 

    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

    Correct Answer
    C. SHOW ERRORS
    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.

    Rate this question:

  • 23. 

    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. /A user executes a JOIN statement that uses four or more tables.

    Correct Answer(s)
    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
    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.

    Rate this question:

  • 24. 

    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?

    • 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);

    Correct Answer
    B. UPD_BAT_STAT(V_ID
    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.

    Rate this question:

  • 25. 

    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

    Correct Answer
    B. You use a database trigger to fire when an INSERT statement occurs
    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.

    Rate this question:

  • 26. 

    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

    Correct Answer
    E. A local subprogram defined within the program unit ORDERTOTAL
    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.

    Rate this question:

  • 27. 

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

    • A.

      VARCHAR2

    • B.

      BOOLEAN

    • C.

      OUT

    • D.

      IN

    Correct Answer
    C. OUT
    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.

    Rate this question:

  • 28. 

    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

    Correct Answer
    B. USER_DEPENDENCIES
    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.

    Rate this question:

  • 29. 

    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

    Correct Answer
    C. A stored procedure
    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.

    Rate this question:

  • 30. 

    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';

    Correct Answer
    A. DROP TRIGGER business_hour;
    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.

    Rate this question:

  • 31. 

    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)

    • 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');

    Correct Answer(s)
    B. EXECUTE INSERT_TEAM(3, V_NAME=>'LONGHORNS', V_CITY=>'AUSTIN');
    C. EXECUTE INSERT_TEAM(3, 'AUSTIN','LONGHORNS');
    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.

    Rate this question:

  • 32. 

    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.

    Correct Answer
    A. Be stored only in the database.
    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.

    Rate this question:

  • 33. 

    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

    Correct Answer(s)
    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.
    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.

    Rate this question:

  • 34. 

    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')

    Correct Answer(s)
    A. EXECUTE add_dept(p_loc=>2500)
    B. EXECUTE add_dept('Education', 2500)
    C. EXECUTE add_dept('2500', p_loc =>2500)
    E. EXECUTE add_dept(p_loc=>2500, p_name=>'Education')
  • 35. 

    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

    Correct Answer(s)
    A. Querying with the SELECT * notification.
    B. Declaring variables with the %TYPE attribute
    D. Declaring records by using the %ROWTYPE attribute.
  • 36. 

    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.

    Correct Answer(s)
    A. The view associated with the trigger
    C. The event associated with the trigger.
  • 37. 

    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?

    • A.

      CALC_TAX

    • B.

      INSERT_EMP

    • C.

      UPDATE_SAL

    • D.

      DELETE_EMP

    • E.

      UPDATE_EMP /MANAGE_EMPS

    Correct Answer
    C. UPDATE_SAL
  • 38. 

    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.

    Correct Answer
    D. Use the DBMS_LOB.FILECLOSE procedure to close the file being accessed.
    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

    Rate this question:

  • 39. 

    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?

    • A.

      V_PLAYER_AVG := .333;

    • 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.

    Correct Answer
    D. This variable cannot be assigned a value from outside of the package.
  • 40. 

    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?

    • 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. /g_comm has a value of 10 at 9:03am for both Jones and Smith

    Correct Answer
    B. G_comm has a value of 15 at 9:06am for Jones
  • 41. 

    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?

    • A.

      DROP gen_email_name;

    • B.

      REMOVE gen_email_name;

    • C.

      DELETE gen_email_name;

    • D.

      DROP FUNCTION gen_email_name;

    Correct Answer
    D. DROP FUNCTION gen_email_name;
  • 42. 

    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

    Correct Answer(s)
    A. EXECUTE UPD_BAT_STAT;
    B. EXECUTE UPD_BAT_STAT(V_AB=>10, V_ID=>31);
    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.

    Rate this question:

  • 43. 

    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?

    • 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.

    Correct Answer
    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.
    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.

    Rate this question:

  • 44. 

    Which view displays indirect dependencies, indenting each dependency?

    • A.

      DEPTREE

    • B.

      IDEPTREE

    • C.

      INDENT_TREE

    • D.

      I_DEPT_TREE

    Correct Answer
    B. IDEPTREE
    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.

    Rate this question:

  • 45. 

    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?

    • 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

    Correct Answer
    D. Change the trigger to a statement-level trigger by removing FOR EACH ROW
    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.

    Rate this question:

  • 46. 

    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))

    Correct Answer(s)
    A. CREATE OR REPLACE FUNCTION tax_amt (p_id NUMBER) RETURN NUMBER
    C. . CREATE OR REPLACE PROCEDURE tax_amt (p_id NUMBER, p_amount OUT NUMBER)
    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.

    Rate this question:

  • 47. 

    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.

    Correct Answer
    C. The trigger fails because a SELECT statement on the table being updated is not allowed.
    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.

    Rate this question:

  • 48. 

    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?

    • 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.

    Correct Answer
    E. This statement fails.
    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.

    Rate this question:

  • 49. 

    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;

    Correct Answer
    D. ALTER TABLE employees DISABLE ALL TRIGGERS;
    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.

    Rate this question:

  • 50. 

    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.

    Correct Answer
    C. Stored in the database.
    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.

    Rate this question:

Quiz Review Timeline +

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
Back to Top Back to top
Advertisement
×

Wait!
Here's an interesting quiz for you.

We have other quizzes matching your interest.