Can use aggregate functions inside cursor
152933Jun 7 2006 — edited Jun 7 2006Hi
Can i use aggergate functiions inside cursors because i was getting the below error message when try to execute the below procedure.
I need following thins to implement procedure ,When pass 100 through parameter ,that will check the total count on the table if matches delete the records from table .
create or replace procedure p12(p_count number) is
cnt number :=0;
tot number :=0;
cursor c1 is select count(1),c2,rowid from t1 where
group by c2,rowid;
begin
for y in c1
loop
delete from t1 where row_id=y.rowid;
cnt:=y.cnt+1;
tot:=y.tot+1;
if mod(y.cnt,100)=0
then
dbms_output.put_line(y.tot||'total records deleted');
end if;
end loop;
end;
/
4/14 PL/SQL: SQL Statement ignored
4/55 PL/SQL: ORA-00936: missing expression
Thanksinadvance
MR