最先答对且答案未经编辑的puber将获得纪念章一枚(答案不可编辑但可发新贴补充或纠正),其他会员如果提供有价值的分析、讨论也可获得纪念章一枚。
每两周的优胜者可获得itpub奖励的技术图书一本。
以往旧题索引:
http://www.itpub.net/forum.php?m ... eid&typeid=1808
原始出处:
http://www.plsqlchallenge.com/
作者:Kim Berg Hansen
运行环境:SQLPLUS, SERVEROUTPUT已打开
注:本题给出答案时候要求给予简要说明才能得到奖品
我有一张员工表,包含每个员工的薪资:
create table plch_employee (
id integer primary key
, name varchar2(10)
, salary number
)
/
insert into plch_employee values (1, 'Zaphod', 1000)
/
commit
/
每个选项包含一系列语句。
哪些选项能成功地执行所有语句不出异常,并且使得执行之后Zaphod的薪资为2000, 因此下列查询会得到所示的输出:
select id, name, salary
from plch_employee
order by id
/
ID NAME SALARY
---------- ---------- ----------
1 Zaphod 2000
(A)
update plch_employee
set salary = 2000
where id = 1
/
savepoint
/
update plch_employee
set salary = 3000
where id = 1
/
rollback to savepoint
/
(B)
update plch_employee
set salary = 2000
where id = 1
/
savepoint savepoint
/
update plch_employee
set salary = 3000
where id = 1
/
rollback to savepoint savepoint
/
(C)
update plch_employee
set salary = 2000
where id = 1
/
savepoint after_2000
/
update plch_employee
set salary = 3000
where id = 1
/
rollback to savepoint after_2000
/
(D)
update plch_employee
set salary = 2000
where id = 1
/
savepoint after_upd
/
update plch_employee
set salary = 3000
where id = 1
/
savepoint after_upd
/
rollback to after_upd
/
(E)
update plch_employee
set salary = 1500
where id = 1
/
savepoint after_1500
/
update plch_employee
set salary = 2000
where id = 1
/
savepoint after_2000
/
update plch_employee
set salary = 2500
where id = 1
/
savepoint after_2500
/
rollback to after_2000
/
(F)
update plch_employee
set salary = 1500
where id = 1
/
savepoint after_1500
/
update plch_employee
set salary = 2000
where id = 1
/