Oracle 游标小用

-- Created on 2010/06/25 by WANGNAN
declare
  -- Local variables here
  i integer;
  TYPE t_cur IS REF CURSOR;
  v_cur t_cur;
  v_col VARCHAR2( 20);
BEGIN
  -- Test statements here
 
  OPEN v_cur FOR SELECT colno FROM test;
  FETCH v_cur INTO v_col;
  CLOSE v_cur;
  dbms_output.put_line(v_col);
  EXCEPTION WHEN OTHERS THEN
            dbms_output.put_line( sqlerrm);
           
end;

你可能感兴趣的:(oracle)