SET SERVEROUTPUT ONDECLARE —-声明变量和游标v_product_id products.product_id%TYPE;v_name products.name%TYPE;v_price products.price%TYPE;CURSOR v_product_cursor IS select product_id, name, price from products order by product_id ;BEGIN —-打开游标 OPEN v_product_cursor;LOOP —-获取游标的列 FETCH v_product_cursor INTO v_product_id, v_name, v_price ; EXIT WHEN v_product_cursor%NOTFOUND ; —-显示到屏幕上 DBMS_OUTPUT.PUT_LINUE( ’v_product_id='|| v_product||', v_name='||v_name||', v_price='||v_price );END LOOP;CLOSE v_product_cursor ;END;/====================================================================================set serveroutput ondeclare —-声明变量和游标 v_product_id products.product_id%type; v_name products.name%type; v_price products.price%type; cursor v_product_cursor is select product_id, name, price from products order by product_id ;begin —-for循环输出到屏幕上 for v_product_cursor loop dbms_output.put_line( ‘v_product_id=‘|| v_product_id||’,v_name=‘||v_name||’,v_price=‘||v_price ); end loop;end;/