SQL> CREATE TABLE products(
2 name VARCHAR2(50),
3 price NUMBER(8,2)
4 );
Table created.
SQL>
SQL>
SQL> declare
2 cursor get_data is select name, price from products;
3 begin
4 for i in get_data
5 LOOP
6 if i.price > 50 then
7 dbms_output.put_line(i.name || ' Price: ' || i.price);
8 end if;
9 END LOOP;
10 end;
11 /
PL/SQL procedure successfully completed.
SQL>
SQL> drop table products;
Table dropped.
SQL>
SQL>
|