declare
type assoc_arr is table of varchar2(255) index by varchar2(255);
apollo_commanders assoc_arr;
begin
apollo_commanders(‘Apollo 11′) := ‘Neil Armstrong’;
apollo_commanders(‘Apollo 12′) := ‘Pete Conrad’;
apollo_commanders(‘Apollo 13′) := ‘James Lovell’;
apollo_commanders(‘Apollo 14′) := ‘Alan Shepard’;
apollo_commanders(‘Apollo 15′) := ‘David Scott’;
apollo_commanders(‘Apollo 16′) := ‘John W. Young’;
apollo_commanders(‘Apollo 17′) := ‘Eugene A. Cernan’;
dbms_output.put_line(apollo_commanders(‘Apollo 11′));
dbms_output.put_line(apollo_commanders(‘Apollo 14′));
end;
/
– Results:
– Neil Armstrong
– Alan Shepard
Znalezione na: http://tylermuth.wordpress.com/2008/02/21/plsql-associative-arrays/