MERGE INTO bonuses b
USING (
SELECT employee_id, salary, dept_no
FROM employee
WHERE dept_no =20) e
ON (b.employee_id = e.employee_id)
WHEN MATCHED THEN
UPDATE SET b.bonus = e.salary * 0.1
DELETE WHERE (e.salary < 40000)
WHEN NOT MATCHED THEN
INSERT (b.employee_id, b.bonus) VALUES (e.employee_id, e.salary * 0.05) WHERE (e.salary > 40000);
----------------------------------------------------
MERGE INTO bonuses b
USING dual e
ON (b.employee_id = ? )
WHEN MATCHED THEN
UPDATE SET b.bonus = e.salary * 0.1
WHEN NOT MATCHED THEN
INSERT (b.employee_id, b.bonus) VALUES (e.employee_id, e.salary * 0.05) WHERE (e.salary > 40000);
'๐ป Programming > Oracle 11g' ์นดํ ๊ณ ๋ฆฌ์ ๋ค๋ฅธ ๊ธ
[์ค๋ผํด/oracle] SQL ์๋ํฐ๋ก vi ์ฌ์ฉํ๊ธฐ (0) | 2015.04.20 |
---|---|
[์ค๋ผํด/oracle] ๋ด(ํ์ฌ) ๊ณ์ ๊ถํ ์กฐํํ๊ธฐ (0) | 2015.04.20 |
[Oracle/SQL] ํน์ ์ฌ์ฉ์์ ๊ถํ ์กฐํ (0) | 2015.04.20 |
[์ค๋ผํด/oracle] Oracle Database Character set ๋ณ๊ฒฝ(EUC-KR์ UTF8 ๋ณ๊ฒฝ) (0) | 2015.04.20 |
[์ค๋ผํด/oracle] select ... for update (0) | 2015.04.20 |