日期:2014-05-16  浏览次数:21062 次

未找到关键字from
create or replace procedure insert_tb_conut
(
 p_empID in tb_employee.empid%type
)
is

v_empid tb_salary.empid%type;
v_salary tb_salary.salary%type;
v_bonus tb_salary.bonus%type;
v_deduct tb_salary.bonus%type;
v_ewdate date;
v_ewconut tb_extrawork.ewconut%type;
v_taxrate number;
v_holiday number:=4;
v_deptAllowance tb_department%type;
v_ewsalary number;
begin
  --获取数据
  --获取部门津贴
  SELECT deptAllowance into v_deptAllowance from tb_department where deptID=(SELECT deptID from tb_employee where empid=p_empID);
  --获取各种字段数据
  SELECT t1.empid into v_empid,t1.Salary INTO v_salary, t1.bonus INTO v_bonus, t1.deduct INTO v_deduct, nvl(t2.ewdate,null) INTO v_ewdate, nvl(t2.ewconut,null) INTO v_ewconut FROM tb_salary t1 left join tb_Extrawork t2 ON t1.empid = t2.EmpID where t1.empid=insert_tb_conut.p_empID);
  SELECT salary INTO v_sal from tb_salary;
   
   
  v_ewsalary:=v_ewconut*(v_salary/monthDay);
   
   
  --获取税率
  if v_salary>4500 then
  v_taxrate:=0.2;
  else
  v_taxrate:=0.03;
  end if;
   
  --插入数据
  insert INTO tb_conut(cuntid,empid,bonus,deduct,ewdate,ewconut,taxrate,holiday,deptallowance,ewsalary) values(sep_employee_empid.nextval,v_empid,v_bonus,v_deduct,v_ewdate,v_ewconut,v_taxrate,v_holiday,v_deptAllowance,v_ewsalary);
end;

PL/SQL:ORA-00923:未找到要求的FROM关键字
PL/SQL:SQL Statement ignored



------解决方案--------------------
end procedure_name;
------解决方案--------------------
select into 哪有你这么写的。
SQL code

  --获取各种字段数据
  SELECT T1.EMPID,
         T1.SALARY,
         T1.BONUS,
         T1.DEDUCT,
         NVL(T2.EWDATE, NULL),
         NVL(T2.EWCONUT, NULL)
    INTO V_EMPID, V_SALARY, V_BONUS, V_DEDUCT, V_EWDATE, V_EWCONUT
    FROM TB_SALARY T1
    LEFT JOIN TB_EXTRAWORK T2
      ON T1.EMPID = T2.EMPID
   WHERE T1.EMPID = INSERT_TB_CONUT.P_EMPID);
  SELECT SALARY INTO V_SAL FROM TB_SALARY;