TAILIEUCHUNG - Oracle Database 10g The Complete Reference phần 5

Tham khảo tài liệu 'oracle database 10g the complete reference phần 5', 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ả | Chapter 29 An Introduction to PL SQL 523 RADIUS AREA 3 4 5 6 Because the area value for a Radius value of 6 exceeds 100 no further Radius values are processed and the PL SQL block completes. Simple Cursor Loops You can use the attributes of a cursor such as whether or not any rows are left to be fetched as the exit criteria for a loop. In the following example a cursor is executed until no more rows are returned by the query. To determine the status of the cursor the cursor s attributes are checked. Cursors have four attributes you can use in your program FOUND A record can be fetched from the cursor. NOTFOUND No more records can be fetched from the cursor. ISOPEN The cursor has been opened. ROWCOUNT The number of rows fetched from the cursor so far. The FOUND NOTFOUND and ISOPEN cursor attributes are Booleans they are set to either TRUE or FALSE. Because they are Boolean attributes you can evaluate their settings without explicitly matching them to values of TRUE or FALSE. For example the following command will cause an exit to occur when rad_cursor NOTFOUND is TRUE KLầsaii exit when rad_cursor NOTFOUND In the following listing a simple loop is used to process multiple rows from a cursor declare pi constant NUMBER 9 7 area NUMBER 14 2 cursor rad_cursor is select from RADIUS_VALS rad_val rad_cursor ROWTYPE begin open rad_cursor loop fetch rad_cursor into rad_val exit when rad_cursor NOTFOUND area pi power 2 insert into AREAS values area end loop close rad_cursor end 524 Part IV PL SQL The loop section of the PL SQL block uses values from the RADIUS_VALS table as its input. Instead of basing the exit criteria on the Area value the cursor s NOTFOUND attribute is checked. If no more rows are found in the cursor then NOTFOUND will be TRUE and therefore the loop will be exited. The commented version of the loop is shown in the following listing L loop fetch Within the loop fetch a record. rad_cursor into .

TÀI LIỆU LIÊN QUAN
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.