create or replace procedure CHECK_NEW_ORDERS (id_of_order in integer) is
cursor c1 is select * from reservations_orders r where r.id_orders=id_of_order;
cursor c2( resident_count in integer, room_count in integer) is SELECT * FROM hotels h left join guest_rooms g on g.id_of_hotel=h.id_of_hotel
where
g.g_resident_count=resident_count and
g.g_rooms_count=room_count;
begin
open c1;
open c2(1,1);
if c2%found then -- не срабатывает не при found, не при notfound
update reservations_orders rr set rr.r_status=2
where rr.id_orders=19;
commit;
end if;
/* Здесь работает.
update reservations_orders rr set rr.r_status=2
where rr.id_orders=19;
commit;
*/
close c2;
close c1;
end CHECK_NEW_ORDERS;