Oracle cursor use (EXPLICIT cursor)

Source: Internet
Author: User
Tags oracle cursor

1.

SetServeroutput on; Declare     CursorTem_cursor is            Select *  fromXuesheng xs; V_row Tem_cursor%RowType;begin     OpenTem_cursor; LoopFetchTem_cursor intoV_row; Exit  whenTem_cursor%NOTFOUND;    Dbms_output.put_line (v_row.xing_ming); EndLoop; CloseTem_cursor;End;/

2.

SetServeroutput on;Declare    cursorTmp_cur is           SelectXing_ming,yu_wen,shu_xue fromXuesheng; V_xing_ming xuesheng.xing_ming%type; V_yu_wen Xuesheng.yu_wen%type; V_shu_xue Xuesheng.shu_xue%type;begin    Opentmp_cur; LoopFetchTmp_cur intov_xing_ming, V_yu_wen, V_shu_xue; Exit  whenTmp_cur%NOTFOUND;    Dbms_output.put_line (v_xing_ming); EndLoop; Closetmp_cur;End;/

3.

Set  on ; Declare    cursor  is           Select Xs.xing_ming,xs.yu_wen,xs.shu_xue              from Xuesheng xs; begin     for inch tem_cur     Loop        dbms_output.put_line (tem_xs.xing_ming);     End Loop; End ; /

In the previous section of the database. (Do not like to spray oh)

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.