2

我在PLSQL过程中需要这样的东西

 arrayCount:=parArray.Count;
 For i In 1 .. arrayCount Loop
    lsPar(i):=parArray(i);
 End Loop;

是否可以?谢谢你的建议!:)

4

1 回答 1

9

如果你正在工作oracle,那么这个匿名块将为你工作

 declare
    TYPE parArray IS TABLE OF VARCHAR2(64) index by binary_integer;
    v_parArray parArray;
    arrayCount number;
    lsPar parArray;

    begin
    v_parArray(1):='A';
    v_parArray(2):='B';
    v_parArray(3):='C';

    arrayCount:=v_parArray.Count;
       For i In 1 .. arrayCount 
       Loop
          lsPar(i):=v_parArray(i);
       End Loop;

     arrayCount:=lsPar.Count;
        For i In 1 .. arrayCount
         Loop
          dbms_output.put_line('The value of Ispar at index '||i||' is '||lsPar(i));
        End Loop;
     end;  

输出

 The value of Ispar at index 1 is A
 The value of Ispar at index 2 is B
 The value of Ispar at index 3 is C
于 2012-09-14T14:33:44.210 回答