就是下面这条语句导致这条记录不能更新
Code
update mw_log
set qw = (select sum(qw) sm
from mw_log
where mc != '合计'
and lb = 'A'
and to_char(rq, 'yyyy-mm') = '2009-01'),
zd = (select sum(zd) sm
from mw_log
where mc != '合计'
and lb = 'A'
and to_char(rq, 'yyyy-mm') = '2009-01'),
gd = (select sum(gd) sm
from mw_log
where mc != '合计'
and lb = 'A'
and to_char(rq, 'yyyy-mm') = '2009-01'),
gx = (select sum(gx) sm
from mw_log
where mc != '合计'
and lb = 'A'
and to_char(rq, 'yyyy-mm') = '2009-01'),
yn = (select sum(yn) sm
from mw_log
where mc != '合计'
and lb = 'A'
and to_char(rq, 'yyyy-mm') = '2009-01'),
gz = (select sum(gz) sm
from mw_log
where mc != '合计'
and lb = 'A'
and to_char(rq, 'yyyy-mm') = '2009-01'),
hn = (select sum(hn) sm
from mw_log
where mc != '合计'
and lb = 'A'
and to_char(rq, 'yyyy-mm') = '2009-01')
where lb = 'A'
and mc = '合计'
and to_char(rq, 'yyyy-mm') = '2009-01'
后来上面查询一下,估计是记录被锁啦,为啥呢?
用select* from v$open_cursor where sql_text like '%表名%' 搜索,好样的36条.........
咋办,继续找,终于发现了
Code
SELECT /*+ rule */
s.username,
decode(l.type, 'TM', 'TABLE LOCK', 'TX', 'ROW LOCK', NULL) LOCK_LEVEL,
o.owner,
o.object_name,
o.object_type,
s.sid,
s.serial#,
s.terminal,
s.machine,
s.program,
s.osuser
FROM v$session s, v$lock l, dba_objects o
WHERE l.sid = s.sid
AND l.id1 = o.object_id(+)
AND s.username is NOT NULL
发现真是记录被锁了,只好用alter system kill session '114,20742' 杀掉啦