我正在尝试编写一个包含三种不同条件的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
答案 0 :(得分: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
有关参考,请参阅here。