rem This program accesses the STOCK table to retrieve current
rem stock prices. The stock symbol is passed as a parameter
set serveroutput on size 20000
declare
stsymbol stock.stocksymbol%type;
stname stock.stockname%type;
stprice stock.currentprice%type;
begin
stsymbol := '&1';
select stockname, currentprice
into stname, stprice
from stock
where stocksymbol = stsymbol;
dbms_output.put_line('The price of ' || rtrim(stname) ||
' stock is ' || to_char(stprice, '999.99'));
exception
when no_data_found then
dbms_output.put_line('Stock not found');
end;
/