I. PL/SQL table
The PL/SQL table has only two columns, where the first column is listed as an integer type and the second column is the user custom.
Defined:
TYPE < type name > is TABLE of Types of < columns > [Not NULL] INDEX by Binary_integer;
The type of < column > can be a data class row for Oracle and a user-defined type.
Property Method:
. Count-Returns the total number of rows in a PL/SQL table
. delect--Delete all the contents of the PL/SQL table
. Delect (number of rows)--delete the specified row of the PL/SQL table
. DELCT (start line, end line)--delete multiple rows of the PL/SQL table
. First-Returns the initial index of a table;
. Next (number of rows)-the index of the next bar of this line number;
. Last-Returns the final index of the table;
Ii. PL/SQL Records
The PL/SQL table has only one row, but there are multiple columns.
Defined:
TYPE < type name > is RECORD < column name 1 type 1, column name 2 type 2,... Column name N type n,> [not NULL]
The type of < column > can be a data class row for Oracle and a user-defined type, and can be a nesting of record types.
Iii. combined use of PL/SQL tables and PL/C records
Example:
DECLARE CURSOR c_1 is SelectEmpno,ename,job,sal fromEMP; TYPE myrecord is RECORD (Empno emp.empno%type,ename emp.ename%type,job emp.job%type,sal Emp.sal%type);--Define a myrecoed named pl/SQL record type; TYPE mytable is TABLE of Myrecord index by Binary_integer; --Defines a PL/SQL table type named mytable; the field type is pl/SQL record type; n Number:=1; tab_1 mytable; --instantiate a Tab_1 object for the mytable type; BEGIN--Assign Value forIinchc_1 Loop tab_1 (n). Empno:=I.empno; Tab_1 (n). ename:=I.ename; Tab_1 (N). Job:=I.job; Tab_1 (n). Sal:=i.sal; N:=n+1; End Loop; N:=1; --Output forIinchN.. Tab_1.count Loop Dbms_output.put_line (i||' '|| Tab_1 (i). empno| |' '|| Tab_1 (i). ename| |' '|| Tab_1 (i). job| |' '||tab_1 (i). Sal); End Loop; END;
Oracle PL/SQL tables, record types