barcodefontsoft.com

summarizes the codes and their meanings. in Java Embed barcode 128 in Java summarizes the codes and their meanings.

Table 22.1 summarizes the codes and their meanings. using jar toreceive barcode 128 for asp.net web,windows application QR Code Safe Use TABLE 22.1 Pragma Restrictions PURITY LEVEL CODE DESCRIPTION ASSERTION WNDS WNPS RNDS RNPS Writes no database state Writes no package state Reads no database state Reads no package state No modification of any d atabase table No modification of any packaged variable No reading of any database table No reading of any package variable. D) If you add the follow javabean code 128 barcode ing three lines, will the package compile without error UPDATE STUDENT SET Employer = "Prentice Hall" WHERE employer is NULL;. So that the entire packa ge body would now look like this: -- ch22_2c.sql CREATE OR REPLACE PACKAGE BODY school_api AS PROCEDURE discount_cost. Lab 22.1 Exercises IS CURSOR c_group_discou nt IS SELECT distinct s.course_no, c.description FROM section s, enrollment e, course c WHERE s.

section_id = e.section_id GROUP BY s.course_no, c.

description, e.section_id, s.section_id HAVING COUNT(*) >=8; BEGIN FOR r_group_discount IN c_group_discount LOOP UPDATE course SET cost = cost * .

95 WHERE course_no = r_group_discount.course_no; DBMS_OUTPUT.PUT_LINE ("A 5% discount has been given to" .

r_group_discount.course_no " ". r_group_discount.descrip Code 128 Code Set B for Java tion); END LOOP; END discount_cost; FUNCTION new_instructor_id RETURN instructor.instructor_id%TYPE IS v_new_instid instructor.

instructor_id%TYPE; BEGIN SELECT INSTRUCTOR_ID_SEQ.NEXTVAL INTO v_new_instid FROM dual; RETURN v_new_instid; EXCEPTION WHEN OTHERS THEN DECLARE v_sqlerrm VARCHAR2(250) := SUBSTR(SQLERRM,1,250); BEGIN RAISE_APPLICATION_ERROR(-20003, "Error in instructor_id: ". v_sqlerrm); END; END new _instructor_id; FUNCTION total_cost_for_student (i_student_id IN student.student_id%TYPE) RETURN course.cost%TYPE IS v_cost course.

cost%TYPE; BEGIN SELECT sum(cost) INTO v_cost FROM course c, section s, enrollment e. Lab 22.1 Exercises WHERE c.course_no = s.co urse_no AND e.

section_id = s.section_id AND e.student_id = i_student_id; UPDATE STUDENT SET employer = "Prentice Hall" WHERE employer is null; RETURN v_cost; EXCEPTION WHEN OTHERS THEN RETURN NULL; END total_cost_for_student; BEGIN SELECT trunc(sysdate, "DD") INTO v_current_date FROM dual; END school_api; ANSWER: No.

You added an update statement and violated the purity level of the pragma restriction WNDS (writes no database state). You receive the following error message when you try to compile the new package: Errors for PACKAGE BODY SCHOOL_API: LINE/COL ERROR -------- ----------------------------------------------------------44/3 PLS-00452: Subprogram "TOTAL_COST_FOR_STUDENT" violates its associated pragmaErrors for PACKAGE BODY SCHOOL_API: 22.1.

3. Overload Modules When you overload module s, you give two or more modules the same name. The modules parameter lists must differ in a manner significant enough for the compiler (and runtime engine) to distinguish between the different versions. You can overload modules in three contexts:.

. In a local module in the same PL/SQL block . In a package specification . In a package body Complete the following tasks:. A) Add the following lin code128b for Java es to the package specification of school_api. Then recompile the package specification. Explain what you have created.

-- ch22_3a.sql CREATE OR REPLACE PACKAGE school_api as v_current_date DATE; PROCEDURE Discount_Cost; FUNCTION new_instructor_id RETURN instructor.instructor_id%TYPE; FUNCTION total_cost_for_student (i_student_id IN student.

student_id%TYPE). Lab 22.1 Exercises RETURN course.cost%TYPE; applet Code 128 PRAGMA RESTRICT_REFERENCES (total_cost_for_student, WNDS, WNPS, RNPS); PROCEDURE get_student_info (i_student_id IN student.student_id%TYPE, o_last_name OUT student.

last_name%TYPE, o_first_name OUT student.first_name%TYPE, o_zip OUT student.zip%TYPE, o_return_code OUT NUMBER); PROCEDURE get_student_info (i_last_name IN student.

last_name%TYPE, i_first_name IN student.first_name%TYPE, o_student_id OUT student.student_id%TYPE, o_zip OUT student.

zip%TYPE, o_return_code OUT NUMBER); END school_api; ANSWER: No, you have not created Frankenstein; it s just an overloaded procedure. The specification has two procedures with the same name and different IN parameters in both number and datatype. The OUT parameters also differ in number and datatype.

This overloaded function accepts either of the two sets of IN parameters and performs the version of the function corresponding to the datatype passed in. B) Add the following code to the body of the package school_api. Explain what is accomplished.

-- ch22_4a.sql CREATE OR REPLACE PACKAGE BODY school_api AS PROCEDURE discount_cost IS CURSOR c_group_discount IS SELECT distinct s.course_no, c.

description FROM section s, enrollment e, course c WHERE s.section_id = e.section_id GROUP BY s.

course_no, c.description, e.section_id, s.

section_id HAVING COUNT(*) >=8; BEGIN FOR r_group_discount IN c_group_discount LOOP UPDATE course SET cost = cost * .95 WHERE course_no = r_group_discount.course_no; DBMS_OUTPUT.

PUT_LINE ("A 5% discount has been given to" . r_group_discount.course_no " ". r_group_discount.descrip tion); END LOOP; END discount_cost; FUNCTION new_instructor_id RETURN instructor.instructor_id%TYPE.

Lab 22.1 Exercises v_new_instid instructor. instructor_id%TYPE; BEGIN SELECT INSTRUCTOR_ID_SEQ.NEXTVAL INTO v_new_instid FROM dual; RETURN v_new_instid; EXCEPTION WHEN OTHERS THEN DECLARE v_sqlerrm VARCHAR2(250) := SUBSTR(SQLERRM,1,250); BEGIN RAISE_APPLICATION_ERROR(-20003, "Error in instructor_id: ".

v_sqlerrm); END; END new USS Code 128 for Java _instructor_id; FUNCTION total_cost_for_student (i_student_id IN student.student_id%TYPE) RETURN course.cost%TYPE IS v_cost course.

cost%TYPE; BEGIN SELECT sum(cost) INTO v_cost FROM course c, section s, enrollment e WHERE c.course_no = s.course_no AND e.

section_id = s.section_id AND e.student_id = i_student_id; RETURN v_cost; EXCEPTION WHEN OTHERS THEN RETURN NULL; END total_cost_for_student; PROCEDURE get_student_info (i_student_id IN student.

student_id%TYPE, o_last_name OUT student.last_name%TYPE, o_first_name OUT student.first_name%TYPE, o_zip OUT student.

zip%TYPE, o_return_code OUT NUMBER) IS BEGIN SELECT last_name, first_name, zip INTO o_last_name, o_first_name, o_zip FROM student WHERE student.student_id = i_student_id; o_return_code := 0;.
Copyright © barcodefontsoft.com . All rights reserved.