Code:
declare
v_purchase number;
begin
SELECT min(software.purchase_cost)
into v_purchase
from hardware, software
where :hardware.hw_serial_num = software.hw_serial_num;
go_block('software');
first_record;
for i in 1..:system.last_record
loop
go_record(i);
if nvl(:software.purchase_cost,0) = v_purchase then
exit;
else
next_record;
end if;
end loop;
end;