select * bulk collect into v_array from tableName 当查询到的数据为空时,bulk collect into v_array会不会报异常?
在线等。。。
------解决方案--------------------------------------------------------
- SQL code
--测试了一下貌似不会DECLARE TYPE T_ARRARY IS VARRAY(10) OF VARCHAR2(20); V_ARRARY T_ARRARY;BEGIN SELECT EMPNO BULK COLLECT INTO V_ARRARY FROM EMP WHERE 1 = 2; DBMS_OUTPUT.PUT_LINE(1);EXCEPTION WHEN OTHERS THEN DBMS_OUTPUT.PUT_LINE(SQLERRM);END;DECLARE V_ARRARY VARCHAR2(20);BEGIN SELECT EMPNO INTO V_ARRARY FROM EMP WHERE 1 = 2; DBMS_OUTPUT.PUT_LINE(1);EXCEPTION WHEN OTHERS THEN DBMS_OUTPUT.PUT_LINE(SQLERRM);END;