TAILIEUCHUNG - PL/SQL User’s Guide and Reference phần 4

PL / SQL hỗ trợ nhân vật hai bộ gọi là bộ ký tự cơ sở dữ liệu, được sử dụng cho các định danh và mã nguồn, và nhân vật thiết lập quốc gia, được sử dụng cho dữ liệu NLS. NCHAR nhân vật kiểu dữ liệu và lưu trữ NVARCHAR2, cho phép bạn xử lý dữ liệu nhân vật duy nhất-byte và đa-byte và chuyển đổi giữa các bộ ký tự. | Using Cursor FOR Loops LOOP FETCH INTO emp_rec EXIT WHeN NOTFOuND END LOOP CLOSE END The scope of a packaged cursor is not limited to a particular PL SQL block. So when you open a packaged cursor it remains open until you close it or you disconnect your Oracle session. Using Cursor FOR Loops In most situations that require an explicit cursor you can simplify coding by using a cursor FOR loop instead of the OPEN FETCH and CLOSE statements. A cursor FOR loop implicitly declares its loop index as a ROWTYPE record opens a cursor repeatedly fetches rows of values from the result set into fields in the record and closes the cursor when all rows have been processed. Consider the PL SQL block below which computes results from an experiment then stores the results in a temporary table. The FOR loop index c1_rec is implicitly declared as a record. Its fields store all the column values fetched from the cursor c1. Dot notation is used to reference individual fields. -- available online in file examp7 DECLARE result TYPE CURSOR c1 IS SELECT n1 n2 n3 FROM data_table where exper_num 1 BEGIN FOR c1_rec IN c1 LOOP calculate and store the results result INSERT INTO temp VALUES result NULL NULL END LOOP COMMIT END When the cursor FOR loop is entered the cursor name cannot belong to a cursor already opened by an OPEN statement or enclosing cursor FOR loop. Before each iteration of the FOR loop PL SQL fetches into the implicitly declared record. The record is defined only inside the loop. You cannot refer to its fields outside the loop. Interaction with Oracle 5-13 Using Cursor FOR Loops The sequence of statements inside the loop is executed once for each row that satisfies the query associated with the cursor. When you leave the loop the cursor is closed automatically even if you use an EXIT or GOTO statement to leave the loop prematurely or an exception is raised inside the loop. Using Subqueries You need

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.