而如果沒有這句話「index by binary_integer」,那就得要顯示對初始化,且每插入乙個元素到numbers型別的table中時,都需要先extend.
示例:
沒加「index by binary_integer」時:
declare
type my_number_arr is table of number;
n my_number_arr:= my_number_arr();
begin
n.extend;
n(1) := 2;
n.extend;
n(2) := 3;
for i in1 .. n.count loop
dbms_output.put_line(n(i));
end loop;
end;
輸出:2,3
而如果加了「index by binary_integer」,**如下寫就可以達到上面的效果
declare
type my_number_arr is table of number index by binary_integer;
n my_number_arr;
begin
n(1) := 2;
n(2) := 3;
for i in1 .. n.count loop
dbms_output.put_line(n(i));
end loop;
end;
create
orreplace
procedure
pro_parttable_auto
asv_table_name varchar2(100);
type type_array_str is
table
ofvarchar2(32)
index
byvarchar
(32);
v_array_table type_array_str;
begin
v_array_table('static_agg_hour'
) :=
'part_agghour_'
; v_array_table('static_agg_province_day'
) :=
'part_prov_'
; v_table_name := v_array_table.first
; loop
exit when
v_table_name
isnull
; dbms_output.put_line(v_array_table(v_table_name));
dbms_output.put_line(v_table_name);
v_table_name := v_array_table.next
(v_table_name);
endloop;
end;
oracle自定義型別
1 定義乙個型別 sql create or replace type propertyvalue as object number value number,string value varchar2 2000 date value date,member function getnumberva...
oracle 自定義型別
例1 批量 查詢部門號為 10 號的並把它們列印出來 declare type emp table type is table of my emp rowtype index by binary integer v emp table emp table type begin select bulk...
自定義型別
typedef型別 typedef 已有型別 新建型別 示例 typedef double area,volume typedef int number number i1 area a enum enum 列舉型別名 enum week 預設sun 0,可以比較 如果修改必須形如enum week...