0 Replies Latest reply on Oct 3, 2012 8:21 AM by yasser_egypt

    error rep-1401 in report 6i

    yasser_egypt
      dear sirs,
      when i run the report i got this error rep_1401 cf_2formula fatal pl/sql error occurred
      known that after i trace i find that the error come because report not see the value inside the paramater :budg_type
      the code is here
      -------------------------
      function CF_2Formula return Number is
      cursor c1 is SELECT
      to_char(A.DUE_DATE,'mm') ,
      SUM(nvl (b.EST_CRAFT,0)) man,
      SUM(nvl (b.EST_TOOL,0)) tol,
      SUM(nvl (b.EST_SUPPLY,0)) con,
      SUM(nvl (b.EST_SPARES,0)) mat,
      SUM(nvl (b.EST_MISC,0)) misc
      FROM PLANNING_SIMULATION A ,maintenance_plans b
      WHERE A.EQUIPMENT_ID = B.equip_EQUIPMENT_ID(+)
      AND A.MAINTENANCE_WORK_ID = B.mw_MAINTENANCE_WORK_ID(+)
      AND to_number(to_char(a.due_date,'yyyy')) =:YEAR
      and A.EQUIPMENT_ID IN (SELECT EQUIPMENT_ID FROM EQUIPMENT WHERE
                     COSTCENTER_COST_CENTER_ID = :COST_CENTER)
      and to_char(A.DUE_DATE,'mm') = :mon
      group by to_char(A.DUE_DATE,'mm');


      rec c1%rowtype;
      total number(10,3);

      begin

      open c1;
      fetch c1 into rec;
      close c1;
      total := nvl(rec.mat,0)+nvl(rec.con,0)+nvl(rec.man,0)+nvl(rec.tol,0)+nvl(rec.misc,0);
      --if :cf_budg_type = 'material' then
      if :budg_type = 'material' then
           total := rec.mat;
           return(total);

      elsif :budg_type = 'contract' then
           total := rec.con;
           return(total);

      elsif :budg_type = 'manpower' then
           total := rec.man;
           return(total);

      elsif :budg_type = 'tool' then
           total := rec.tol;
           return(total);

      elsif :budg_type = 'misc.' then
           total := rec.misc;
           return(total);

      elsif :budg_type = 'totals' then
           return(total);
      end if;
      end;
      --------------------------------------
      when i make hash for the if statement it work without problem, please advice me how to solve this and why if statement not feel what inside the paramter even i try to print the contents of paramater and it was ok

      help me pls
      Yasser