4 fetch in the fetch stage rows are selected and

Info iconThis preview shows page 1. Sign up to view the full content.

View Full Document Right Arrow Icon
This is the end of the preview. Sign up to access the rest of the document.

Unformatted text preview: e 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. WWW.ExamMagic.COM - 17: What part of a database trigger determines the number of times the trigger body executes? A. Trigger type www.ExamMagic.com 1Z0-147 B. Trigger body C. Trigger event D. Trigger timing Answer: A WWW.ExamMagic .COM - 18: 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) || [email protected]'; UPDATE employees SET email = v_email_name WHERE employee_id = p_id; RETURN v_email_name; END; You run this SELECT statement: SELECT first_name, last_name gen_email_name(first_name, last_name, 108) EMAIL FROM employees; What occurs? A. Employee 108 has his email name updated based on the return result of the function. B. The statement fails because functions called from SQL expressions cannot perform DML. C. The statement fails because the functions does not contain code to end the transaction. D. The SQL statement executes successfully, because UPDATE and DELETE statements are ignoring in stored functions called from SQL expressions. E. The SQL statement executes successfully and control is passed to the calling environment. Answer: B • 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 www.ExamMagic.com 1Z0-147 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. WWW.ExamMagic.COM - 19: 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 Answer: C In the USER_OBJECTS there is Incorrect Answers 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 WWW.ExamMagic.COM - 20: 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; / www.ExamMagic.com 1Z0-147 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. Answer: E Explanation: The Triggering Event is incorrect. A User does not LOGON or LOGOFF from a Table. You can't create a BEFORE LOGON or AFTER LOGOFF trigger. Event When allowed or applicable STARTUP AFTER SHUTDOWN BEFORE SERVERERROR AFTER LOGON AFTER LOGOFF BEFORE A. This trigger is not performing an INSERT, UPDATE or DELETE on Table B. INSETED OF Triggers are defined on a VIEW C. Application triggers fire when a particular event occurs in the application. Application triggers are developed using Oracle client-side tools, such as Oracle Forms Developer. E. This is a failed attempt of creating a System Event Triiger. Modify the code to specify AFTER LOGON ON DATABASE to correct the problem . WWW.ExamMagic.COM - 21: 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) www.ExamMagic.com 1Z0-147 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. D. The value of DISCOUNT_RATE is set to 0.10 when the package is invoked for the first time in a session. Answer: D A one-time-only procedure is executed only once, when the package is first invoked wit...
View Full Document

This note was uploaded on 01/05/2011 for the course COMS 131 taught by Professor Dad during the Spring '10 term at University of Mumbai.

Ask a homework question - tutors are online