oracle数据库存储过程,提示缺少关键字
--在teachers表中,根据教师的收入计算个人所得税,收入低于或等于1000元的,无个人所得税;--收入在1000元以上,3000元以下的,个人所得税为3%;收入在3...
--在teachers表中,根据教师的收入计算个人所得税,收入低于或等于1000元的,无个人所得税;
--收入在1000元以上,3000元以下的,个人所得税为3%;收入在3000元以上的,个人所得税为5%;
create or replace procedure addtax()
as
dis float ;
begin
insert into tax
select t.teacher_id, (t.bonus+t.wage) depoist ,(t.bonus+t.wage)*(
case when (t.bonus+t.wage) <1000 then dis = 0.00;
when (t.bonus+t.wage) between 1000 and 3000 then dis =0.03;
when (t.bonus+t.wage) >3000 then dis = 0.05;
end case;
) from teachers t
end; 展开
--收入在1000元以上,3000元以下的,个人所得税为3%;收入在3000元以上的,个人所得税为5%;
create or replace procedure addtax()
as
dis float ;
begin
insert into tax
select t.teacher_id, (t.bonus+t.wage) depoist ,(t.bonus+t.wage)*(
case when (t.bonus+t.wage) <1000 then dis = 0.00;
when (t.bonus+t.wage) between 1000 and 3000 then dis =0.03;
when (t.bonus+t.wage) >3000 then dis = 0.05;
end case;
) from teachers t
end; 展开
1个回答
展开全部
Create Or Replace Procedure Addtax As
Dis Float;
Begin
Insert Into Tax
Select t.Teacher_Id,
(t.Bonus + t.Wage) Depoist,
(t.Bonus + t.Wage) * (Case
When (t.Bonus + t.Wage) < 1000 Then
0.00
When (t.Bonus + t.Wage) Between 1000 And 3000 Then
0.03
When (t.Bonus + t.Wage) > 3000 Then
0.05
End Case)
From Teachers t;
End;
Dis Float;
Begin
Insert Into Tax
Select t.Teacher_Id,
(t.Bonus + t.Wage) Depoist,
(t.Bonus + t.Wage) * (Case
When (t.Bonus + t.Wage) < 1000 Then
0.00
When (t.Bonus + t.Wage) Between 1000 And 3000 Then
0.03
When (t.Bonus + t.Wage) > 3000 Then
0.05
End Case)
From Teachers t;
End;
追问
还是有问题啊,提示end case 处缺失右括号
追答
Create Or Replace Procedure Addtax As
Dis Float;
Begin
Insert Into Tax
Select t.Teacher_Id,
(t.Bonus + t.Wage) Depoist,
(t.Bonus + t.Wage) * (Case
When (t.Bonus + t.Wage) 3000 Then
0.05
End)
From Teachers t;
End;
本回答被提问者采纳
已赞过
已踩过<
评论
收起
你对这个回答的评价是?
推荐律师服务:
若未解决您的问题,请您详细描述您的问题,通过百度律临进行免费专业咨询