ORACLE 自定义类型
用create type 变量as table of 类型和create type 变量as object(
字段1 类型1,
字段2 类型2
);
与type 变量is table of 类型和type 变量is record(
字段1 类型1,
字段2 类型2
);
区别是用create 后面用as , 若直接用type 后面用is
create 是创object , 而type 是创record .
1. TYPE tabletype IS TABLE OF type INDEX BY BINARY_INTEGER;
定义:TYPE t_charTable IS TABLE OF VARCHAR2(10) INDEX BY BINARY_INTEGER;
引用:tableName(index);
例子:
declare
type t_table is table of varchar2(10) index by BINARY_integer;
MyTab t_table;
begin
MyTab(1) := 'A';
MyTab(2) := 'B';
MyTab(3) := 'C';
DBMS_OUTPUT.PUT_LINE('First index:'||' '|| mytab(1) ||' ');
end;
DECLARE
TYPE t_StudentTable IS TABLE OF students%ROWTYPE INDEX BY