2017-10-06 106 views
0

錯誤我得到: enter image description hereORA-00936:缺少表達錯誤

的錯誤是在拋出「插入」在程序語句。目標表具有與插入語句中相同的列數和數據類型。

我的做法是:

create or replace procedure updatetax 
is 
date_30 date:=sysdate-(365*30); 
date_50 date:=sysdate-(365*50); 
/*employees less than 30 years of age*/ 
cursor c1 is 
select eid 
from employee 
where dateofbirth>date_30 
and enddate is null; 
/*employees between the age of 30 and 50*/ 
cursor c2 is 
select eid 
from employee 
where dateofbirth between date_50 and date_30; 
/*employees greater than 50 years of age*/ 
cursor c3 is 
select eid 
from employee 
where dateofbirth<date_50; 
r1 employee.eid%type; 
r2 employee.eid%type; 
r3 employee.eid%type; 
begin 
    open c1; 
    for r1 in c1 
    loop 
    insert into emptax 
    values(r1.eid,gettaxlessthan30(select salary from empsalary where eid=r1.eid),sysdate); 
    end loop; 
    close c1; 
    commit; 
    open c2; 
    for r2 in c2 
    loop 
    insert into emptax 
    values(r2.eid,gettaxbetween30and50(select salary from empsalary where eid=r2.eid),sysdate); 
    end loop; 
    commit; 
    open c3; 
    close c2; 
    for r3 in c3 
    loop 
    insert into emptax 
    values(r3.eid,gettaxgreaterthan50(select salary from empsalary where eid=r3.eid),sysdate); 
    end loop; 
    commit; 
    close c3; 
end; 
/

調用存儲過程的功能是以下邏輯:

create or replace function gettaxlessthan30(esalary_in number) 
return number 
is 
    tax_out number(10,2); 
begin 
    tax_out:=0.07*esalary_in; 
    return tax_out; 
end; 
/

回答

0

解決 - 從開始再次重寫了程序和它的工作正好。