Skip to content

Commit 4537b70

Browse files
authored
Create update-returning.sql
1 parent 1c869b5 commit 4537b70

File tree

1 file changed

+19
-0
lines changed

1 file changed

+19
-0
lines changed
Lines changed: 19 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,19 @@
1+
REM Script in 23c: update-returning.sql
2+
3+
SELECT ename, sal FROM emp
4+
WHERE ename = 'KING';
5+
6+
-- create variables in SQL*Plus and Update with returning
7+
VARIABLE old_salary NUMBER
8+
VARIABLE new_salary NUMBER
9+
10+
UPDATE emp
11+
SET sal=sal+1000
12+
WHERE ename = 'KING'
13+
RETURNING OLD sal, NEW sal into :old_salary, :new_salary;
14+
15+
-- check the result
16+
PRINT old_salary
17+
PRINT new_salary
18+
19+
rollback;

0 commit comments

Comments
 (0)