최신 9i Internet Application Developer 1Z0-147 무료샘플문제:
1. Examine this package:
CREATE OR REPLACE PACKAGE BB_PACK
IS
V_MAX_TEAM_SALARY NUMBER(12,2);
PROCEDURE ADD_PLAYER(V_ID IN NUMBER, V_LAST_NAME VARCHAR2,
V_SALARY_NUMBER;
END BB_PACK;
/
CREATE OR REPLACE PACKAGE BODY BB_PACK
IS
PROCEDURE UPD_PLAYER_STAT
(V_ID IN NUMBER, V_AB IN NUMBER DEFAULT 4, V_HITS IN NUMBER)
IS
BEGIN
UPDATE PLAYER_BAT_STAT
SET AT_BATS = AT_BATS + V_AB,
HITS = HITS + V_HITS
WHERE PLAYER_ID = V_ID)
COMMIT;
END UPD_PLAYER_STAT;
PROCEDURE ADD_PLAYER
(V_ID IN NUMBER, V_LAST_NAME VARCHAR2, V_SALARY NUMBER)
IS
BEGIN
INSERT INTO PLAYER(ID,LAST_NAME,SALARY)
VALUES (V_ID, V_LAST_NAME, V_SALARY);
UPD_PLAYER_STAT(V_ID,0.0);
END ADD_PLAYER;
END BB_PACK;
Which statement will successfully assign $75,000,000 to the V_MAX_TEAM_SALARY variable
from within a stand-alone procedure?
A) V_MAX_TEAM_SALARY := 7500000;
B) This variable cannot be assigned a value from outside the package.
C) BB_PACK.ADD_PLAYER.V_MAX_TEAM_SALARY := 75000000;
D) BB_PACK.V_MAX_TEAM_SALARY := 75000000;
2. The add_player, upd_player_stat, and upd_pitcher_stat procedures are grouped together in a package. A variable must be shared among only these procedures.
Where should you declare this variable?
A) In a database trigger.
B) In the package specification.
C) In the package body.
D) In each procedure's DECLARE section, using the exact same name in each.
3. Examine this code:
CREATE OR REPLACE PACKAGE metric_converter
IS
c_height CONSTRAINT NUMBER := 2.54;
c_weight CONSTRAINT NUMBER := .454;
FUNCTION calc_height (p_height_in_inches NUMBER)
RETURN NUMBER;
FUNCTION calc_weight (p_weight_in_pounds NUMBER)
RETURN NUMBER;
END;
/
CREATE OR REPLACE PACKAGE BODY metric_converter
IS
FUNCTION calc_height (p_height_in_inches NUMBER)
RETURN NUMBER
IS
BEGIN
RETURN p_height_in_inches * c_height;
END calc_height;
FUNCTION calc_weight (p_weight_in_pounds NUMBER)
RETURN NUMBER
IS
BEGIN
RETURN p_weight_in_pounds * c_weight
END calc_weight
END metric_converter;
/
CREATE OR REPLACE FUNCTION calc_height (p_height_in_inches NUMBER)
RETURN NUMBER
IS
BEGIN
RETURN p_height_in_inches * metric_converter.c_height;
END calc_height;
/
Which statement is true?
A) If you remove the stand alone stored function CALC_HEIGHT, then the METRIC_CONVERTER package body and the package specification are removed.
B) The stand alone function CALC_HEIGHT cannot be created because its name is used in a packaged function.
C) If you remove the package body, then the package specification and the stand alone stored function CALC_HEIGHT are removed.
D) If you remove the package specification, then the package body and the stand alone stored function CALC_HEIGHT are removed.
E) If you remove the package specification, then the package body is removed.
F) If you remove the package body, then the package specification is removed.
4. 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)
A) The format parameter p_bonus_value is declared but is not used anywhere.
B) You cannot update a table using a stored procedure.
C) The syntax of the UPDATE statement is incorrect.
D) The formal parameter p_cutoff cannot have a DEFAULT clause.
E) The declaration of the format parameter p_bonus_percent cannot have a DEFAULT clause.
F) The declaration of the format parameter p_margin cannot have a DEFAULT clause.
5. 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('2500', p_loc =>2500)
B) EXECUTE add_dept('Education', 2500)
C) EXECUTE add_dept(p_loc=>2500, p_name=>'Education')
D) EXECUTE add_dept(p_loc=>2500)
E) EXECUTE add_dept(p_name=>'Education', 2500)
질문과 대답:
질문 # 1 정답: D | 질문 # 2 정답: C | 질문 # 3 정답: E | 질문 # 4 정답: E,F | 질문 # 5 정답: A,B,C,D |