I have procedure, inside of it, I tried to execute an "insert", but it is sending that error Can anyone give me a hint to solve this error? I tried to read the Oracle documentation to figure out where I'm wrong, but so far I have not found anything that can help me.
create or replace procedure read_file as
begin
DECLARE
V1 VARCHAR2(200);
F1 UTL_FILE.FILE_TYPE;
emptylines number(10):=0;
read_lines number(10):=0;
alarm_counter number(10):=0;
BEGIN
--deschidere fisier
F1 := UTL_FILE.FOPEN('ONCIOIU','text.txt','R');
--itinerare fiecare linie din fisierul text
Loop
BEGIN
UTL_FILE.GET_line(F1,V1);
read_lines := read_lines+1;
dbms_output.put_line(V1);
-- Determine the number of empty rows
if V1 is null then
emptylines :=emptylines+1;
end if;
-- Determine the number of alarms
if emptylines =2 then
alarm_counter :=alarm_counter+1;
end if;
insert into alarms (id) values(alarm_counter)
EXCEPTION WHEN No_Data_Found THEN EXIT; END;
end loop;
dbms_output.put_line(V1);
dbms_output.put_line('Numar de linii citite '||read_lines);
dbms_output.put_line('Numar de randuri goale '||emptylines);
dbms_output.put_line('Numar de alarme '||alarm_counter);
-- Close file
UTL_FILE.FCLOSE(F1);
END;
end;
/