preview

Plsql Chap8 Sols

Better Essays

Chapter 8

Review Questions
1. b
2. c
3. a,c
4. b
5. a,b
6. d
7. b
8. b
9. a
10. c
11. b
12. b
13. b
14. d
15. a,c

16. Dependencies on packaged program units are driven by the package specification. Any changes to the header of the packaged program units being referenced will change the status of the dependent object to INVALID. Changes to the body only will not alter the status of dependent objects.

17. BASK_CALC_SP ORDER_TOTAL_SP

18. To be aware of affected objects and the recompilation needs. A developer should test any dependent program units and recompile objects made INVALID manually to avoid this processing at runtime. In addition, remote dependencies will cause a runtime error if objects not recompiled.

19. If a …show more content…

ARCHAR2) IS
BEGIN
SELECT idstage INTO p_stage FROM bb_basketstatus WHERE idBasket = p_bask; p_desc := lookup_pkg.status_desc_pf(p_stage);
END;
/
SELECT status FROM user_objects WHERE object_name = 'STATUS_CHECK_SP ';
CREATE OR REPLACE PACKAGE BODY lookup_pkg IS
FUNCTION status_desc_pf (p_stage IN NUMBER) RETURN VARCHAR2 IS lv_stage_txt VARCHAR2(30);
BEGIN
IF p_stage = 1 THEN lv_stage_txt := 'Order Submitted '; ELSIF p_stage = 2 THEN lv_stage_txt := 'Accepted, sent to shipping '; ELSIF p_stage = 3 THEN lv_stage_txt := 'Backordered '; ELSIF p_stage = 4 THEN lv_stage_txt := 'Cancelled '; ELSIF p_stage = 5 THEN lv_stage_txt := 'Shipped '; ELSIF p_stage = 6 THEN lv_stage_txt := 'Credit Card Not Approved '; END IF; RETURN lv_stage_txt;
END;
END;
/
SELECT status FROM user_objects WHERE object_name = 'STATUS_CHECK_SP ';

Assignment 8-4
Note: Be sure to use an appropriate connection string reference for the database link
CREATE DATABASE LINK dblink2 USING 'orcl ';
CREATE OR REPLACE FUNCTION status_desc_sf (p_stage NUMBER) RETURN VARCHAR2 IS lv_stage_txt VARCHAR2(30);
BEGIN
IF p_stage = 1 THEN lv_stage_txt := 'Order Submitted '; ELSIF p_stage = 2 THEN lv_stage_txt := 'Accepted, sent to shipping '; ELSIF p_stage = 3 THEN lv_stage_txt := 'Backordered '; ELSIF p_stage = 4 THEN lv_stage_txt := 'Cancelled '; ELSIF p_stage = 5 THEN lv_stage_txt := 'Shipped '; END IF; RETURN

Get Access