Tài liệu PL/SQL User’s Guide and Reference phần 4

Thảo luận trong 'Căn Bản' bắt đầu bởi Thúy Viết Bài, 5/12/13.

  1. Thúy Viết Bài

    Thành viên vàng

    Bài viết:
    198,891
    Được thích:
    167
    Điểm thành tích:
    0
    Xu:
    0Xu
    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.
     

    Các file đính kèm:

Đang tải...