Network Security Internet Technology Development Database Servers Mobile Phone Android Software Apple Software Computer Software News IT Information

In addition to Weibo, there is also WeChat

Please pay attention

WeChat public account

Shulou

Oralce record collection

2025-01-17 Update From: SLTechnology News&Howtos shulou NAV: SLTechnology News&Howtos > Database >

Share

Shulou(Shulou.com)06/01 Report--

Oracle record collection

Record

PL/SQL supports three types of records: table-based (table-based),

Cursor-based (cursor-based) and programmer defined (programmer-defined)

A table-based record is that the structure of the record comes from a list of all fields in the database table.

A cursor-based record is the structure of the record that comes from the select list of cursors.

To create a table-based or cursor-based record, you can make

Use the% ROWTYPE attribute. Syntax:

Record_name table_name or cursor_name%ROWTYPE

User-defined record

The syntax is as follows:

TYPE type_name IS RECORD-declare the record type

(field_name1 DATATYPE1

Field_name2 DATATYPE2

……

Field_nameN DATATYPEN)

Record_name TYPE_NAME;-- declaration record variable

Add: when a record type has only one field, it has no practical meaning equivalent to variable, but this field can come from cursor.

Set

How to write a declaration collection:

TYPE type_name IS TABLE OF element_type

INDEX BY index_type

TYPE type_name IS VARRAY (size_limit) OF element_type

Element_type can be:

Any datatype,suchas number

Table_name.column_name%type

Table_name%rowtype

Cursor_name%rowtype.

Welcome to subscribe "Shulou Technology Information " to get latest news, interesting things and hot topics in the IT industry, and controls the hottest and latest Internet news, technology news and IT industry trends.

Views: 0

*The comments in the above article only represent the author's personal views and do not represent the views and positions of this website. If you have more insights, please feel free to contribute and share.

Share To

Database

Wechat

© 2024 shulou.com SLNews company. All rights reserved.

12
Report