Type arr is table of varchar2(5) index by binary integer;

解决方案 »

  1.   

    其实ORACLE PL/SQL中的Table复合数据类型就是数祖的概念Type yourtablearr
     is table of varchar2(20) index by binary integer;
      

  2.   

    type index_table is table of varchar2(2000) index by binary_integer;
    type nested_table is table of varchar2(2000);
    type v_arrary is varray(1000) of varchar2(2000);
      

  3.   

    A PL/SQL table is a single column array. The PL/SQL table is indexed by a binary integer counter so you can reference any value stored in a PL/SQL table in an indexed fashion. The number of rows in a PL/SQL table is dynamic, it can be increased as desired. PL/SQL tables are declared in two steps.  First, the table type is declared, then the PL/SQL table variable is assigned to that table type. The PL/SQL declarations can occur in any block of a pl/sql construct. A PL/SQL table cannot be initialized in its declaration. The first reference to a PL/SQL table must be an assignment statement or a NO_DATA_FOUND will result. PL/SQL tables follow the same scope rules as other variables and cease to exist when the package, function or procedure is exited.
    Example:In this example, we declare a table type of NUMBER and then assign two tables, results and n10. Notice how the indexes are used in each to specify a specific value.CREATE OR REPLACE FUNCTION max_value RETURN NUMBER IS
    TYPE numtab IS TABLE OF NUMBER
    INDEX BY BINARY_INTEGER;
    results  numtab;
    n10 numtab;
    max_loop NUMBER;
    temp_store NUMBER;
    CURSOR get_results IS 
    SELECT result FROM result_table;
    i  integer;
    x integer:=1;
    j integer:=1;
    BEGIN
    OPEN get_results;
    FOR i IN 1..1500 LOOP
    FETCH get_results INTO temp_store;
    IF i = MOD(x,15) THEN
    results(j):=temp_store;
    END IF;
    END LOOP;
    j:=1;
    FOR i IN 1..10 LOOP
    n10(i):=GREATEST(results(j),results(j+1),results(j+2),
                    results(j+3),results(j+4),results(j+6),
                    results(j+7),results(j+7),results(j+8),
                    results(j+9));
    j:=j+10;
    END LOOP;
    j:=1
    max_loop:=GREATEST(n10(j),n10(j+1),n10(j+2),
                      n10(j+3),n10(j+4),n10(j+5),n10(j+6),n10(j+7),
                      n10(j+8),n10(j+9);
    RETURN max_loop;
    END;