日期:2014-05-16  浏览次数:20766 次

求大神帮忙,oracle 存储过程,我有一张税率表。
应发工资 > 1300 元部分开始计算所得税
  0~ 1300 不用缴税
1300 ~ 1800 按 工资 * 5% -65
1300 ~ 3300 按 工资 * 10% -155
1300 ~ 6300 按 工资 * 15% -320
需求是这样子的,
我的表示这样子的
 工资下限,工资上限,扣除数,税率

  0.00 1300.00 0.00 0.00
1300.00 1800.00 65.00 0.05
1300.00 3300.00 155.00 0.10
1300.00 6300.00 320.00 0.15

求大神教导,写个存储过程,我传入一个工资进去怎么判断传入的工资属于哪个区间,多谢!求详细!

------解决方案--------------------
SQL code

--大概就是这个样子,自已改下就可以了
create or replace procedure p_t(p_sal number)
as
v_shangxian number;
v_xiaxian number;
v_kouchushu number;
v_tax number;
begin
    execute immediate 'select 工资下限,工资上限,扣除数,税率 from 你的表 where :1 between 工资下限 and 工资上限'
        into v_shangxian,v_xiaxian,v_kouchushu,v_tax
        using p_sal;
    dbms_output.put_line(v_shangxian);
end;
/

------解决方案--------------------
SQL code
declare 
  -- Local variables here
  i integer;
begin
  if i-1300<0 then 
   dbms_output.put_line('no');
   return;
  end if;
  for item in (select * from 表) loop
      if item.上限-i>=0 then
        dbms_output.put_line('按这个标准交');
        return;
      end if;
  end loop;
end;
我的异常网推荐解决方案:oracle存储过程,http://www.aiyiweb.com/oracle-develop/177537.html
我的异常网推荐解决方案:软件开发者薪资,http://www.aiyiweb.com/other/1391128.html