A simple example of weak ref cursor

Source: Internet
Author: User

Declare <br/> l_ SQL varchar2 (2000): = 'select deptno, LOC from Scott. dept '; <br/> l_where varchar2 (200); </P> <p> type dept_curtype is ref cursor; <br/> dept_cur dept_curtype; <br/> type dept_rec is record (<br/> deptno varchar2 (200) -- attention the record element order <br/>, Loc varchar2 (200 )); <br/> type dept_tbl is table of dept_rec; <br/> l_dept_tbl dept_tbl; </P> <p> begin <br/> l_where: = 'where deptno =: deptno'; <br/> l_ SQL: = l_ SQL | l_where; <br/> open dept_cur for l_ SQL <br/> using 40 -- using is not necessary <br/>; <br/> fetch dept_cur bulk collect <br/> into l_dept_tbl; <br/> close dept_cur; </P> <p> dbms_output.put_line ('L _ str_tbl.count = '| l_dept_tbl.count); <br/> <l_dept_tbl_loop> <br/> for I in 1 .. l_dept_tbl.count <br/> loop <br/> dbms_output.put_line ('L _ str_tbl ('| I | '). deptno = '| <br/> l_dept_tbl (I ). deptno | ', l_str_tbl (' | I | <br/> '). loc = '| l_dept_tbl (I ). loc); </P> <p> end loop l_dept_tbl_loop; <br/> end; <br/>

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.