Cursor cursor: (loop operation of batch data)

Source: Internet
Author: User
Declare Cursor  Stus_cur  Is  Select* FromStudents; -- defines the cursor and assigns a value (is cannot be used separately from cursor) cur_stu students % Rowtype; -- Define rowtype Begin Open  Stus_cur; -- Enable cursor Loop-- Loop Exit  WhenStus_cur % Notfound; -- Cyclic Condition Fetch  Stus_cur  IntoCur_stu; -- the cursor value is assigned to rowtype dbms_output.put_line (cur_stu.name); -- output End  Loop; -- End the loop Close  Stus_cur; -- Close the cursor End;
PLSQL is a process-oriented language. This type of language also has c, COBOL, etc. The common feature of this type of language is that only one piece of data can be processed at a time, and the object returned by database SQL is a set, in this way, problems may occur when you directly use the PLSQL program. In this environment, a cursor is displayed. The cursor is actually a memory address and points to the result set queried by SQL, when necessary, fetch data [fetch] One by one based on the cursor until all data is obtained.
Cursor  Mininter1  Is SelectT1.rm _ interface, t1.rm _ merchno, Min(Getexp (t1.rr _ id, tradeamount, '','', '0') minexp FromT_r_merchant T1 WhereT1.rm _ interface = interid1 OrT1.rm _ interface = interid2 Group  ByT1.rm _ interface, t1.rm _ merchno; Open  Mininter1; Loop Exit  When  Mininter1% Notfound; Fetch  Mininter1  IntoNresult, tmpmchno, minexp; icount: = mininter1 % Rowcount; End  Loop; Close  Mininter1;

 

 

 

 

 

 

 

 

 

 

 

 

Cursor cursor: (loop operation of batch data)

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.