SQL> CREATE TABLE products(
2 name VARCHAR2(50),
3 price NUMBER(8,2),
4 min_price NUMBER(8,2)
5 );
Table created.
SQL>
SQL>
SQL> create or replace procedure print_products
2 as
3 cursor dataCursor is select name, price from products;
4 begin
5 for i in dataCursor LOOP
6 if i.price > 50 then
7 dbms_output.put_line(i.name ||' Price: '|| i.price);
8 else
9 dbms_output.put_line(i.name || ' Product under 50');
10 end if;
11 END LOOP;
12 end;
13 /
Procedure created.
SQL>
SQL> describe print_products
PROCEDURE print_products
SQL>
SQL>
SQL> drop table products;
Table dropped.
SQL>
SQL>
|