Oracle function??è??ùμ??°
?e?÷?°3000
Sql′ú??
create or replace function tax(v_salary in number) return number is
v_expense number;
--±????ù????3y??=é?ò???×????ùμ????ᣨ±????°?ê-é?ò????°?ê£?+é?ò????ù????3yêy
v_quick_deduction number := 0;
v_temp number;
begin
v_temp := v_salary - 3000;
if v_temp <= 1500 then
v_temp := v_temp * 0.05;
elsif v_temp > 1500 and v_temp <= 4500 then
v_temp := v_temp * 0.1;
v_quick_deduction := 1500*(0.1-0.05) + 0;
elsif v_temp > 4500 and v_temp <= 9000 then
v_temp := v_temp * 0.2;
v_quick_deduction := 4500*(0.2-0.1) + 1500*(0.1-0.05);
elsif v_temp > 9000 and v_temp <= 35000 then
v_temp := v_temp * 0.25;
v_quick_deduction := 9000*(0.25-0.2) + 4500*(0.2-0.1) ;
elsif v_temp > 35000 and v_temp <= 55000 then
v_temp := v_temp * 0.3;
v_quick_deduction := 35000*(0.3-0.25) + 9000*(0.25-0.2);
elsif v_temp > 55000 and v_temp <= 80000 then
v_temp := v_temp * 0.35;
v_quick_deduction := 55000*(0.35-0.3) + 35000*(0.3-0.25);
elsif v_temp > 80000 then
v_temp := v_temp * 0.45;
v_quick_deduction := 80000*(0.45-0.35) + 55000*(0.35-0.3);
else
dbms_output.put_line(??à′?í2?ê?????!);
v_temp := 0;
end if;
v_expense := v_temp - v_quick_deduction;
return(v_expense);
end tax;
create or replace function tax(v_salary in number) return number is
v_expense number;
--±????ù????3y??=é?ò???×????ùμ????ᣨ±????°?ê-é?ò????°?ê£?+é?ò????ù????3yêy
v_quick_deduction number := 0;
v_temp number;
begin
v_temp := v_salary - 3000;
if v_temp <= 1500 then
v_temp := v_temp * 0.05;
elsif v_temp > 1500 and v_temp <= 4500 then
v_temp := v_temp * 0.1;
v_quick_deduction := 1500*(0.1-0.05) + 0;
elsif v_temp > 4500 and v_temp <= 9000 then
v_temp := v_temp * 0.2;
v_quick_deduction := 4500*(0.2-0.1) + 1500*(0.1-0.05);
相关新闻>>
- 发表评论
-
- 最新评论 更多>>