product_cursor2.sql

来自「oracle 11 源代码」· SQL 代码 · 共 21 行

SQL
21
字号
-- This script displays the product_id, name, and
-- price columns from the products table using a cursor
-- and a FOR loop

SET SERVEROUTPUT ON

DECLARE
  CURSOR v_product_cursor IS
    SELECT product_id, name, price 
    FROM products
    ORDER BY product_id;
BEGIN
  FOR v_product IN v_product_cursor LOOP
    DBMS_OUTPUT.PUT_LINE(
      'product_id = ' || v_product.product_id ||
      ', name = ' || v_product.name ||
      ', price = ' || v_product.price
    );
  END LOOP;
END;
/

⌨️ 快捷键说明

复制代码Ctrl + C
搜索代码Ctrl + F
全屏模式F11
增大字号Ctrl + =
减小字号Ctrl + -
显示快捷键?