Oracle declared cursor (with no field) rule application

Source: Internet
Author: User
During development, a cursor containing a table that does not have fields may be declared to solve special problems. This article will introduce such problems in detail. For more information, see

During development, a cursor containing a table that does not have fields may be declared to solve special problems. This article will introduce such problems in detail. For more information, see

During development, a cursor containing a table that does not have fields may be declared to solve special problems. This article will introduce such problems in detail. For more information, see

Data. * is a table, and then the fields in other tables are added to the sal_data cursor.
SQL code
The Code is as follows:
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
The Code is as follows:
Salary_data_temp sal_data % rowtype;

Then compile the cursor
SQL code
The Code is as follows:
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;

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.