Usage of the Oracle midstream mark

Source: Internet
Author: User

 
  1.  Declare CursorMy_curIs SelectEmpno, deptnoFromEmp;
  2. Employee_id emp. empno % type;
  3. Dept_id emp. deptno % type;
  4. Begin
  5. OpenMy_cur;
  6. FetchMy_curIntoEmployee_id, dept_id;
  7. While my_cur % found loop
  8. Dbms_output.put_line (employee_id |'Shit'| Dept_id );
  9. FetchMy_curIntoEmployee_id, dept_id;
  10. EndLoop;
  11. End;

Use row variables to obtain cursor Information

 
  1. Declare CursorMycurIs Select*FromEmp;
  2. Var_emp emp % rowtype;
  3. Begin
  4. OpenMycur;
  5. FetchMycurIntoVar_emp;
  6. While mycur % found loop
  7. Dbms_output.put_line (var_emp.ename |':'| + To_char (var_emp.hiredate,'Yyyy-MM-dd'));
  8. FetchMycurIntoVar_emp;
  9. EndLoop;
  10. End;

Implicit cursor

 
  1. DeclareVar_countInteger;
  2. Begin
  3. UpdateASetEname ='B';
  4. Var_count: = SQL % rowcount;
  5. Dbms_output.put_line (to_char (var_count ));
  6. End;

Dynamic Cursor
Definition
Declare type emp_cur_type is ref cursor return emp % rowtype;

New_emp_cur_type emp_cur_type;

Open new_emp_cur_type for select * from emp;

Related Article

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.