TAILIEUCHUNG - advanced sql Functions in Oracle 10G phần 9

LAST và COUNT cung cấp cho cùng một kết quả cho VARRAYs. Đầu tiên và cuối sử dụng trong một vòng lặp Các chức năng đầu tiên và cuối có thể được sử dụng để thiết lập giới hạn trên và dưới của một vòng lặp để truy cập các thành viên của một trong những mảng tại một thời điểm trong PL / SQL. | Collection and OO SQL in Oracle END IF END LOOP end for j in fcur loop END vartest Now SQL exec vartest Will give VA has 2 members MD has 2 members AL has 2 members FL has 4 members LAST and COUNT give the same result for VARRAYs. FIRST and LAST Used in a Loop The functions FIRST and LAST may be used to set the upper and lower limit of a for-loop to access members of the array one at a time in PL SQL. CREATE OR REPLACE PROCEDURE vartest1 vartest1 - program to test access of VARRAYs July 6 2005 - R. Earp IS CURSOR fcur IS SELECT name members FROM club BEGIN FOR j IN fcur LOOP For the club . IF 1 THEN FOR k IN LOOP k END LOOP ELSE There are no members on file END IF 318 Chapter I END LOOP end for j in fcur loop END vartestl Again note the necessity of the IF l clause. Now exec vartest1 Will give For the NY club . There are no members on file For the VA club . Beryl Fred For the MD club . Beryl Fred For the AL club . Brenda Richard For the FL club . Gen John Steph JJ 319 Collection and OO SQL in Oracle Creating User-defined Functions for VARRAYs As we have seen before MEMBER FUNCTIONS can be added to an object creation. In this example we will use a MEMBER FUNCTION to find a given element ofourVARRAY CREATE OR REPLACE TYPE members_type2_obj as object members_type2 mem_type MEMBER FUNCTION member_function sub integer RETURN varchar2 Also as we saw before creating a TYPE with a member function requires us to create a TYPE BODY to define the function s action. The action here is to return a value from the VARRAY given its element number CREATE OR REPLACE TYPE BODY members_type2_obj AS MEMBER FUNCTION member_function sub integer RETURN varchar2 IS BEGIN RETURN members_type2 sub END member_function END end of body definition Now that we have defined a TYPE and a TYPE BODY we can create a table containing a column of our defined .

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.