TAILIEUCHUNG - Oracle PL/SQL by Example- P14

Tham khảo tài liệu 'oracle pl/sql by example- p14', 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ả | 622 APPENDIX D Answers to the Try it Yourself Sections First take a closer look at the IF-THEN-ELSE statement used in Block 1 IF v_num 0 THEN v_num is greater than 0 ELSE v_num is not greater than 0 END IF The condition v_num 0 evaluates to FALSE because NULL has been assigned to the variable v_num. As a result control is transferred to the ELSE part of the IF-THEN-ELSE statement. So the message v_num is not greater than 0 is displayed on the screen. Second take a closer look at the IF-THEN statements used in Block 2 IF v_num 0 THEN v_num is greater than 0 END IF IF NOT v_num 0 THEN v_num is not greater than 0 END IF The conditions of both IF-THEN statements evaluate to FALSE. As a result neither message is displayed on the screen. Chapter 5 Conditional Control CASE Statements 1 Create the following script. Modify the script you created in Chapter 4 project 1 of the Try It Yourself can use either the CASE statement or the searched CASE output should look similar to the output produced by the example you created in Chapter 4. ANSWER Consider the script you created in Chapter 4 SET SERVEROUTPUT ON DECLARE v_day VARCHAR2 15 v_time VARCHAR 8 BEGIN v_day TO_CHAR SYSDATE fmDAY v_time TO_CHAR SYSDATE HH24 MI IF v_day IN SATURDAY SUNDAY THEN v_day v_time IF v_time BETWEEN 12 01 AND 24 00 THEN It s afternoon ELSE It s morning END IF END IF -- control resumes here Done. END Please purchase PDF Split-Merge on to remove this watermark. APPENDIX D Answers to the Try it Yourself Sections 623 Next consider the modified version of the script with nested CASE statements. For illustrative purposes this script uses both CASE and searched CASE statements. Changes are shown in bold. SET SERVEROUTPUT ON DECLARE v_day VARCHAR2 15 v_time VARCHAR 8 BEGIN v_day TO_CHAR SYSDATE fmDay .

TỪ KHÓA LIÊN QUAN
TAILIEUCHUNG - Chia sẻ tài liệu không giới hạn
Địa chỉ : 444 Hoang Hoa Tham, Hanoi, Viet Nam
Website : tailieuchung.com
Email : tailieuchung20@gmail.com
Tailieuchung.com là thư viện tài liệu trực tuyến, nơi chia sẽ trao đổi hàng triệu tài liệu như luận văn đồ án, sách, giáo trình, đề thi.
Chúng tôi không chịu trách nhiệm liên quan đến các vấn đề bản quyền nội dung tài liệu được thành viên tự nguyện đăng tải lên, nếu phát hiện thấy tài liệu xấu hoặc tài liệu có bản quyền xin hãy email cho chúng tôi.
Đã 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.