我在PLSQL过程中需要这样的东西
arrayCount:=parArray.Count;
For i In 1 .. arrayCount Loop
lsPar(i):=parArray(i);
End Loop;
可能吗?谢谢! :)
最佳答案
如果您正在使用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