reate or replace procedure dvb_FAF_4 Is   cursor c_dept IS
    select CUST_nO,COUNT(*) as aa from customer_bak where (  to_char(backup_date,'yyyy-mm-dd')>='2007-11-01' and
        to_char(backup_date,'yyyy-mm-dd')<='2007-11-12') and (backup_status='A' OR backup_status='F' ) GROUP BY CUST_nO ;
BEGIN
   FOR r_dept IN c_dept LOOP
   IF mod(r_dept.aa,2)=1) then
      select status from customer where cust_no=r_dept.cust_No;
       IF status='F' then
              update t_users_temp set status='1' where  CUST_nO=r_dept.cust_No ;
        IF status='1' then
              update t_users_temp set status='F' where  CUST_nO=r_dept.cust_No ;   END LOOP;
   commit;
end dvb_FAF_4;
这是我的存储过程,实际上还算不上,就是我已经有了解决问题的思路,但是我是第一次写,所以语法不太会,希望大家能给指点一下,谢谢。
  下面解释一下我的目的:
CUST_nO,COUNT(*)  这是我查出来的放进游标的值,然后对count(*)取余数,如果是1,则执行select status from customer where cust_no=r_dept.cust_No;此语句。得到一个结果。再进行判断,如果查出来的值是F,则
update t_users_temp set status='1' where  CUST_nO=r_dept.cust_No ;
如果是1,则  update t_users_temp set status='F' where  CUST_nO=r_dept.cust_No;
问题结束。
      希望大家有时间帮我看一下,谢谢!