将多张表(视图)的查询结果汇集到一起:union all
例如:
create view view_name as
select A.a,A.b from A
union all
select B.a,B.b from B
获取当前日期
mysql:sysdate()
sqlserver:CONVERT(varchar,GETDATE(),120)
Oracle查询死锁
—查询死锁进程
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 and s.osuser='geekfly';
—关闭死锁进程
alter system kill session '624' ;