plsql编程

declare 
        v_emp_beforetax scott.emp.sal%type := 6000;
        v_emp_con_tax constant scott.emp.sal%type:= 5000;
        v_emp_cal scott.emp.sal%type;
        v_tax scott.emp.sal%type;
        v_emp_aftertax scott.emp.sal%type;
begin
     v_emp_cal := v_emp_beforetax-v_emp_con_tax;
     case
         when v_emp_cal < 1500 then v_tax := v_emp_cal*0.03-0;
         when v_emp_cal > 1500 and v_emp_cal< 3000 then v_tax := v_emp_cal*0.1-100;
         when v_emp_cal > 3000 and v_emp_cal < 4500 then v_tax := v_emp_cal*0.15-200;
         else v_tax := v_emp_cal*0.3-300;
     end case;
     v_emp_aftertax := v_emp_beforetax-v_tax;
     dbms_output.put_line('税后工资是'||v_emp_aftertax);
     exception 
         when others then  --如果产生了异常
              dbms_output.put_line('出错');
end;



使用&可以获取用户输入的值

declare 
        empno number(2);
begin
     empno := &no;  --使用&可以获取用户输入的值
     dbms_output.put_line(empno);
    exception 
              when others then
                   dbms_output.put_line('Error Code');
end;
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值