Use cursor to create an array in Oracle stored procedures

Source: Internet
Author: User

The following articles mainly introduce how to correctly use the relevant cursor in the Oracle stored procedure, and how to correctly create an array of Oracle, we all know that in the Oracle stored procedure, we can create something similar to an array. The following describes the specific content of this article.

 
 
  1. Type arr is table of varchar2(5) index by binary integer; 

For example, you can put each row of data obtained by using a cursor into an array.

 
 
  1. TYPE V_TABLE1 IS TABLE OF cur1%ROWTYPE INDEX BY PLS_INTEGER; 

% ROWTYPE:

This indicates that the row data type stores a row of data. A row of data can contain multiple columns, similar to a row of data in the table or a row of data in the cursor, for example:

 
 
  1. Vs_row1 table % rowtype;
  2. Vs_row2 cursor % rowtype;

PLS_INTEGER:

Both Binary_Integer and Pls_Integer are integer. The calculation of Binary_Integer variable values is performed by Oracle without Overflow, but the execution speed is slow because it is simulated by Oracle. The execution of Pls_Integer is performed by the hardware, that is, directly by the CPU. Therefore, overflow occurs, but the execution speed is much faster than that of Pls_Integer.
 

The above content describes how to use a cursor in the Oracle stored procedure. I hope it will help you in this regard.

Article by: http://kongbei888.blog.163.com/blog/static/243266132010218104021496/

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.