oracle在编写函数后无法正常编译,出现了下面的两个错误~~
错误(1): PL/SQL: Compilation unit analysis terminated
错误(2,28): PLS-00201: 必须声明标识符 'EMPLOYEE_Z_225.EMPLOYEE_ID'源代码如下:
CREATE OR REPLACE FUNCTION TAX_Z_225(p_empid employee_z_225.employee_id%TYPE ) RETURN NUMBER IS
  tax NUMBER;
  salary NUMBER;
BEGIN
  select e.salary,nvl(e.commission_pct ,0)into salary,tax from employees e
  where e.employee_id=p_empid;
  salary:=salary+tax;
  if salaryl<=1600 then
        tax:=0;
   elsif salary-1600<=500 then
         tax:=(salary-1600)*0.05;
   elsif salary-1600>500 and salary-1600<=2000 then
         tax:=(salary-1600)*0.1;
   elsif salary-1600>2000 and salary-1600<=5000 then
         tax:=(salary-1600)*0.15;
   elsif salary-1600>2000 and salary-1600<=5000 then
         tax:=(salary-1600)*0.15;
   elsif salary-1600>5000 and salary-1600<=20000 then
         tax:=(salaryl-1600)*0.15;
   elsif salary-1600>20000 and salary-1600<=40000 then
         tax:=(salary-1600)*0.15;
   elsif salary-1600>40000 and salary-1600<=60000 then
         tax:=(salary-1600)*0.15;
   elsif salary-1600>60000 and salary-1600<=80000 then
         tax:=(salary-1600)*0.15;
   elsif salary-1600>80000 and salary-1600<=100000 then
         tax:=(salary-1600)*0.15;     
   else tax:=(salary-1600)*0.45;
   end if;
  return(tax);
END TAX_Z_225;求指教~~各位帮帮忙~谢啦~~

解决方案 »

  1.   

    CREATE OR REPLACE FUNCTION TAX_Z_225(p_empid employees.employee_id%TYPE ) RETURN NUMBER IS
      --表employee_z_225不存在,所以不能定义这样的类型,改成employees
      tax NUMBER;
      salary NUMBER;
    BEGIN
      select e.salary,nvl(e.commission_pct ,0)into salary,tax from employees e
      where e.employee_id=p_empid;
      salary:=salary+tax;
      if salary<=1600 then --变量变写错:salaryl应为salary
      tax:=0;
      elsif salary-1600<=500 then
      tax:=(salary-1600)*0.05;
      elsif salary-1600>500 and salary-1600<=2000 then
      tax:=(salary-1600)*0.1;
      elsif salary-1600>2000 and salary-1600<=5000 then
      tax:=(salary-1600)*0.15;
      elsif salary-1600>2000 and salary-1600<=5000 then
      tax:=(salary-1600)*0.15;
      elsif salary-1600>5000 and salary-1600<=20000 then
      tax:=(salary-1600)*0.15; -- --变量变写错:salaryl应为salary
      elsif salary-1600>20000 and salary-1600<=40000 then
      tax:=(salary-1600)*0.15;
      elsif salary-1600>40000 and salary-1600<=60000 then
      tax:=(salary-1600)*0.15;
      elsif salary-1600>60000 and salary-1600<=80000 then
      tax:=(salary-1600)*0.15;
      elsif salary-1600>80000 and salary-1600<=100000 then
      tax:=(salary-1600)*0.15;  
      else tax:=(salary-1600)*0.45;
      end if;
      return(tax);
    END TAX_Z_225;
      

  2.   

    多谢了哈~~我又修改了一下,我的这个数据库里是有employee_z_225这个表的,没有employee的那个~~可能一开始编译器抽了~现在好了哈~~谢谢谢谢~~