很長一段時間內
set serveroutput on
declare
type valrec is record(key varchar
type valtbl is table of valrec index by binary_integer;
mytbl valtbl;
begin
mytbl(
mytbl(
for i in unt loop
if mytbl(i)
dbms_output
end if;
end loop;
end;
/
PL/SQL允許使用index
有了字符串類型
set serveroutput on
declare
type valtbl is table of varchar
mytbl valtbl;
begin
mytbl(
dbms_output
end;
/
使用字符串索引的關聯數組的一個有趣的特性是它們自動地通過當前的國際語言支持(NLS)設置排序
set serveroutput on
declare
type valtbl is table of varchar
mytbl valtbl;
key varchar
begin
mytbl(
mytbl(
mytbl(
key := mytbl
while key is not null loop
dbms_output
key := mytbl
end loop;
end;
/
因為Oracle可以自動地將任何的數據類型轉換為字符串類型
set serveroutput on
declare
type timetbl is table of integer index by varchar
mytbl timetbl;
key varchar
begin
for row in (select * from emp) loop
key := to_char(row
if not mytbl
mytbl(key) :=
end if;
mytbl(key) := mytbl(key) +
end loop;
dbms_output
dbms_output
key := mytbl
while key is not null loop
dbms_output
to_char(to_date(key
||
key := mytbl
end loop;
end;
/
鍵值必須是唯一的並且是大小寫敏感的
關聯數組必須在PL/SQL代碼中手工建立
From:http://tw.wingwit.com/Article/program/Oracle/201311/18565.html