使用条件PL/SQL INSERT ALL

Har*_*9pl 3 oracle plsql

我想做的是写一个有三种不同条件的INSERT语句.

这是我到目前为止所做的(但是这段代码得到了ORA-00913太多的值错误):

INSERT ALL
   WHEN SALARY > 20000 THEN
     INTO SPECIAL_SAL13(EMPLOYEE_ID,HIRE_DATE,MANAGER_ID,SALARY)
   WHEN SALARY <= 20000 THEN
     INTO SAL_HISTORY13(EMPLOYEE_ID,SALARY)
   WHEN SALARY <= 20000 THEN
     INTO MGR_HISTORY13(EMPLOYEE_ID,MANAGER_ID,SALARY)
SELECT EMPLOYEE_ID,HIRE_DATE,MANAGER_ID,SALARY
FROM EMPLOYEES
WHERE EMPLOYEE_ID < 125
Run Code Online (Sandbox Code Playgroud)

Yah*_*hia 5

尝试

INSERT ALL
   WHEN SALARY > 20000 THEN
     INTO SPECIAL_SAL13(EMPLOYEE_ID,HIRE_DATE,MANAGER_ID,SALARY)
     VALUES(EMPLOYEE_ID,HIRE_DATE,MANAGER_ID,SALARY)
   WHEN SALARY <= 20000 THEN
     INTO SAL_HISTORY13(EMPLOYEE_ID,SALARY)
     VALUES(EMPLOYEE_ID,SALARY)
   WHEN SALARY <= 20000 THEN
     INTO MGR_HISTORY13(EMPLOYEE_ID,MANAGER_ID,SALARY)
     VALUES(EMPLOYEE_ID,MANAGER_ID,SALARY)
SELECT EMPLOYEE_ID,HIRE_DATE,MANAGER_ID,SALARY
FROM EMPLOYEES
WHERE EMPLOYEE_ID < 125
Run Code Online (Sandbox Code Playgroud)

供参考,请参见此处.