这几天遇到一个问题,让我头痛很久.实在想不出.特来问下高手门:
我们知道在oracle7中有个结构叫PLSQL表也就是后来的联合数组.
不知道哪为高手知道blulk collect是否可以在oracle7下运行呢?
如下代码能够运行吗?
DECLARE
-- Define an associative array of integers.
TYPE number_table IS TABLE OF bulk_numbers.number_id%TYPE
INDEX BY BINARY_INTEGER;
-- Define a variable of the associative array type.
number_list NUMBER_TABLE;
BEGIN
-- Check if calendar has no elements.
SELECT number_id
BULK COLLECT
INTO number_list
FROM bulk_numbers;
-- Print a title
DBMS_OUTPUT.PUT_LINE('Bulk Collected:');
DBMS_OUTPUT.PUT_LINE('---------------');
-- Loop through to print elements.
FOR i IN number_list.FIRST..number_list.LAST LOOP
-- Print only the first and last two.
IF i = 9999 THEN
-- Print an indexed element from the associative array.
DBMS_OUTPUT.PUT_LINE('Number ['||number_list(i)||']');
END IF;
END LOOP;
END;