日期:2014-05-16  浏览次数:20557 次

oracle数组(is table of...)

set serveroutput on

DECLARE
?TYPE assoc_array IS TABLE OF VARCHAR2(30)
?INDEX BY VARCHAR2(30);


?state_array assoc_array;
BEGIN
? state_array('Alaska') := 'Juneau';
? state_array('California') := 'Sacramento';
? state_array('Oregon') := 'Salem';
? state_array('Washington') := 'Olympia';

? dbms_output.put_line(state_array('Alaska'));
? dbms_output.put_line(state_array('California'));
? dbms_output.put_line(state_array('Oregon'));
? dbms_output.put_line(state_array('Alaska'));
END;