6

I've got a PL/SQL VArray that I'm filling with a BULK COLLECT query like this:

SELECT id
BULK COLLECT INTO myarray
FROM aTable

Now I'd like to pass a slice of this collection into another collection, something like this:

newarray := myarray(2..5)

This should pass the elements 2,3,4 and 5 from myarray to newarray.

I could write a loop and copy the elements, but is there a more compact way to do this?

4

1 回答 1

3

通常,您不想这样做。您在内存中有一个大集合,现在您想要复制它。那将使用更多的内存。通常在这种情况下,您传递整个集合(通过引用,而不是值)并且还提供开始和停止索引。将其留给其他函数以仅处理指定的范围。

于 2009-10-29T16:01:03.840 回答