Đang chuẩn bị liên kết để tải về tài liệu:
Oracle PL/SQL by Example- P3

Không đóng trình duyệt đến khi xuất hiện nút TẢI XUỐNG

Tham khảo tài liệu 'oracle pl/sql by example- p3', công nghệ thông tin, cơ sở dữ liệu phục vụ nhu cầu học tập, nghiên cứu và làm việc hiệu quả | LAB 4.2 Lab 4.2 Exercises 72 ELSE v_letter_grade F END IF -- control resumes here DBMS_OUTPUT.PUT_LINE Letter grade is v_letter_grade EXCEPTION WHEN NO_DATA_FOUND THEN DBMS_OUTPUT.PUT_LINE There is no such student or section END D How would you change the script to define a letter grade without specifying the upper limit of the final grade In the statement v_final_grade BETWEEN 90 and 100 number 100 is the upper limit. ANSWER The script should look similar to the following.Changes are shown in bold. -- ch04_3d.sql version 4.0 SET SERVEROUTPUT ON DECLARE v_student_id NUMBER 102 v_section_id NUMBER 89 v_final_grade NUMBER v_letter_grade CHAR 1 BEGIN SELECT final_grade INTO v_final_grade FROM enrollment WHERE student_id v_student_id AND section_id v_section_id IF v_final_grade 90 THEN v_letter_grade A ELSIF v_final_grade 80 THEN v_letter_grade B ELSIF v_final_grade 70 THEN v_letter_grade C ELSIF v_final_grade 60 THEN v_letter_grade D ELSE v_letter_grade F END IF -- control resumes here DBMS_OUTPUT.PUT_LINE Letter grade is v_letter_grade EXCEPTION WHEN NO_DATA_FOUND THEN DBMS_OUTPUT.PUT_LINE There is no such student or section END Please purchase PDF Split-Merge on www.verypdf.com to remove this watermark. Lab 4.2 Exercises LAB 4.2 73 In this example no upper limit is specified for the variable v_final_grade because the BETWEEN operator has been replaced with the operator. Thus this script can handle a value of v_final_grade that is greater than 100. Instead of assigning letter F to v_letter_ grade in version 1.0 of the script the letter A is assigned to the variable v_letter_grade. As a result this script produces more accurate results. Please purchase PDF Split-Merge on www.verypdf.com to remove this watermark. LAB 4.3 74 LAB 4.3 Nested IF Statements LAB OBJECTIVES After completing this lab you will be able to Use nested IF statements You have encountered different types of conditional controls the IF-THEN statement the IF-THEN-ELSE statement and the ELSIF statement.

TÀI LIỆU LIÊN QUAN
Đã phát hiện trình chặn quảng cáo AdBlock
Trang web này phụ thuộc vào doanh thu từ số lần hiển thị quảng cáo để tồn tại. Vui lòng tắt trình chặn quảng cáo của bạn hoặc tạm dừng tính năng chặn quảng cáo cho trang web này.