我想做的是写一个有三种不同条件的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)
尝试
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)
供参考,请参见此处.
| 归档时间: |
|
| 查看次数: |
2304 次 |
| 最近记录: |