Stored Procedure Exercises

Source: Internet
Author: User

-- cursor is output parameter create OR REPLACE PROCEDURE pro_emp_select (empsal out sys_refcursor) asbegin OPEN empsal for select Empno,sal from EMP;  END Pro_emp_select; -- call declarev_no emp.empno%type;v_sal emp.sal%type;emp_sal sys_refcursor; BEGIN  Pro_emp_select (emp_sal);  LOOP  FETCH emp_sal into v_no,v_sal;  EXIT when emp_sal%NOTFOUND;  Dbms_output.put_line (' number '| | v_no| | ' Salary '| | v_sal);  END LOOP;  CLOSE emp_sal; END;
-- cursor is input parameter create OR REPLACE PROCEDURE pro_emp_in (empsal in sys_refcursor) asv_no emp.empno%type;v_sal Emp.sal%TYPE; BEGIN  LOOP    FETCH empsal into v_no,v_sal;    EXIT when empsal%NOTFOUND;    Dbms_output.put_line (' number '| | v_no| | ' Salary '| | v_sal);  END LOOP; END pro_emp_in;declareemp_sal Sys_refcursor; BEGIN  OPEN emp_sal for SELECT empno,sal from EMP;  Pro_emp_in (emp_sal);  CLOSE emp_sal; END;

Stored Procedure Exercises

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.