Since Oracle 8i (and maybe already in version 8) Oracle offers 'interaction' functionality on dml statements (like insert, delete etc.) by means of the returning clause. This returning clause delivers 'information' from the affected records. For example:
declare
t_name varchar2(100);
t_sal number;
begin
update emp
set sal=sal*2
where empno=7900
returning ename, sal into t_name, t_sal;
dbms_output.put_line (t_name || ' - ' || t_sal);
end;
/
create or replace type vclist is varray(100) of varchar2(50);
create or replace type nlist is varray(100) of number;
declare
t_ns nlist;
t_names vclist;
begin
update emp2
set sal = sal * 2
where deptno = 30
returning ename, sal bulk collect into t_names, t_ns;
for i in t_names.first..t_names.last loop
dbms_output.put_line (t_names (i) || ' - ' || t_ns(i));
end loop;
end;
/
SQL%ROWCOUNT will give you the answer.
insert into [table] ([columns]) values ([values])
returning id into t_id;