create or replace procedure SP_TEST as
title1_value varchar2(30);
number1_value integer:=0;
CURSOR c_1 IS SELECT city_name,COUNT(city_name) FROM view_alarm_KZ1 GROUP BY city_name;
begin
open c_1;
LOOP
FETCH c_1 INTO title1_value,number1_value;
EXIT WHEN c_1%NOTFOUND;
INSERT INTO TFA_ALARM_COUNTER_KZ(TITLE1,Collection_Time,Kz1) VALUES(title1_value,sysdate,number1_value);
END LOOP;
CLOSE c_1;
COMMIT;
EXCEPTION
WHEN OTHERS THEN
ROLLBACK;
end;