ORACLE custom Structure (Record)

Source: Internet
Author: User

Quote this big:

Http://www.cnblogs.com/lovemoon714/archive/2012/02/29/2373780.html

1. Concept and use

Similar to a custom type in C, you can use it to define a field collection for a table.

Defines the format type Recordname is Record (
Field Name field type,
Field Name field type
);

Use steps: 1) to declare struct 2) to define struct-body variable 3) to use.

2. Example:

--using a record in an anonymous block can also be defined in procedures, functions, and packages. Declare    --declaring struct bodiesType Re_stu isrecord (Rname student.name%Type--separate the middle with commasRage Student.age%Type--last field is not signed);--End with a semicolon    --defining struct-body variablesRw_stu Re_stu; cursorC_stu is SelectName,age fromstudent;begin    OpenC_stu; LoopFetchC_stu intoRw_stu;--using struct-body variables        Exit  whenC_stu%NotFound; Dbms_output.put_line ('name ='||Rw_stu.rname||'age ='||rw_stu.rage); EndLoop; CloseC_stu; End;

ORACLE custom Structure (Record)

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.