ORA-00936:缺少表达式错误

时间:2017-10-06 04:27:15

标签: loops cursor procedure ora-00936

我得到的错误: enter image description here

错误被插入'插入'程序中的陈述。目标表具有与insert语句中相同的列数和数据类型。

我的程序是:

$sql = "SELECT Email  , FirstName, LastName,Contact FROM tblUser where UserID=sessionID";
$result = mysqli_query($conn,$sql);

while($row = mysqli_fetch_array ($result)) {
    $arr = array(
        $row["Email"],
        $row["FirstName"],
        $row["LastName"],
        $row["Contact"]
    );

    array_push($json, $arr);
}

$jsonstring = json_encode($json);
echo $jsonstring;

存储过程中调用的函数具有以下逻辑:

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;
/

1 个答案:

答案 0 :(得分:0)

已解决 - 从一开始就重新编写了程序并且工作正常。