8 Replies Latest reply: May 4, 2013 2:01 AM by Nitesh. RSS

    code not getting executed:

    990187
      The requirement if comm+salary is >=3000 then all the details laong with emp info have to be inserted into emp table and comm+sal between 10000 and 20000 the same have to be inserted into emp table. PLZ CHECKOUT AND SPECIFIY THE RIGHT CODE TO DO IT.

      create or replace procedure pps is
      ccsal number;
      cursor comm is
      select salary+nvl(commission_pct,0)from employees;
      begin
      open comm;
      loop
      exit when comm%notfound;
      fetch comm into ccsal;
      if ccsal>=3000 then
      ccsal:=ccsal*10/100;
      insert into emp(employee_id,last_name,salary,commission_pct,totsal) values(employees.employee_id,employees.last_name,employees.salary,employees.commission_pct,ccsal)
      elsif ccsal between 10000 and 2000 then
      ccsal:=ccsal*5/100;
      insert into empinsert into emp(employee_id,last_name,salary,commission_pct,totsal) values(employees.employee_id,employees.last_name,employees.salary,employees.commission_pct,ccsal)
      end if;
      end loop;
      close comm;
      end;
      /

      Edited by: 987184 on May 3, 2013 9:25 PM