Declare a cursor that contains a table that does not have fields

Source: Internet
Author: User


Declare a cursor that contains a table that does not have fields, where data. * is a table, and then add the fields in other tables to the sal_data cursor www.2cto.com SQL code cursor sal_data (cp_center_temp_id varchar2) is select data. *, post. id emp_post_id, doc. salary_Tax_Bd sa_tax_bd, batch. bill_year_month, batch. id batch_id, post. emp_id employee_id from sa_salary_data data left join sa_salary_batch batch on data. sa_batch_id = batch. id left join sa_salary_document doc on data. sa_doc_id = doc. id left join pb_emp_post post on doc. emp_post_id = post. id left join pb_send send on post. send_id = send. id where send. cost_center_id = cp_center_temp_id; use this cursor: declare a variable of this cursor type: SQL code salary_data_temp sal_data % rowtype; www.2cto.com then compile this cursor SQL code open sal_data (center_temp.id ); loop fetch sal_data into salary_data_temp; exit when sal_data % notfound; -- TODO end loop; colse sal_data;

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.