日期:2014-05-16  浏览次数:20304 次

Oracle 集合没有初始化异常的调查。
集合没有初始化异常的调查。
-- Created on 2010/11/02 by WANGNAN
declare
  -- Local variables here
  i integer;
  TYPE t_table IS TABLE OF VARCHAR2(250 );
  v_table t_table := t_table(); --必须得初始化,不初始化无法使用集合
begin
  -- Test statements here
  v_table.extend;
  v_table(1):= 'xx';
  IF v_table IS NOT NULL THEN
     FOR i IN 1 .. v_table.count LOOP
         dbms_output.put_line(v_table(i));
     END LOOP ;
  END IF;
  EXCEPTION
     WHEN OTHERS THEN
       dbms_output.put_line( Sqlerrm);
end;

如上,集合必须初始化。