SQL%ROWCOUNT
Hi All,
I have tried to count the number of insert records that are inserted into a table using a plsql block and used SQL%ROWCOUNT but it shows only one record inserted here is the code.
DECLARE
local_variables....
Cursor c1
is
select * from temp_table;
BEGIN
IF NOT c1%ISOPEN THEN
OPEN c1;
END IF;
LOOP
FETCH c1
INTO lcoal_variables;
EXIT WHEN lc1%NOTFOUND;
if
conditions
end if;
insert into new_table (coulmns...) values (local_varible values);
end loop;
dbms_output.put_line('# of rows inserted: '|| SQL%ROWCOUNT);
IF SQL%NOTFOUND
THEN
DBMS_OUTPUT.PUT_LINE('No records Inserted');
Close C1;
END;
---------------
After this is executed the output shows that only one record is inserted but when queried the table it shows 13000 records inserted. SQL%ROWCOUNT is not showing all the inserted records
Please advice what is wrong that I am doing.
Thanks,
user12048986
Edited by: user12048986 on Aug 17, 2010 8:38 AM