SELECT * FROM employees AS OF TIMESTAMP TRUNC(SYSDATE) TIMESTAMP是9i新加的类型,以前的版本没有. 只有在9i以后版本运行没错,这是sql92规范需求,时间精确度极高.
原文如下:Finding All Rows That Were Added Today: Example -- TRUNC(SYSDATE) gives us midnight this morning, the start of the day. -- By using the MINUS operator, we can see which rows are present now but -- were not present at the start of the day. They might be entirely new -- employees, or employees whose data was changed today so their row doesn't -- match the row from yesterday. DROP TABLE employees_changed_today; CREATE TABLE employees_changed_today AS SELECT * FROM employees MINUS SELECT * FROM employees AS OF TIMESTAMP TRUNC(SYSDATE);
AS OF 的语句我在SQL Reference好像没有找到。ex: SELECT TIMESTAMP '1997-01-31 09:26:50.124' FROM dual;
这个你的文档不是很清楚了吗我测了 815报错,920通过,与你给的文档完全一致AS OF TIMESTAMP TRUNC(SYSDATE);好像是说在trunc(sysdate)之前所有的记录
TIMESTAMP是9i新加的类型,以前的版本没有.
只有在9i以后版本运行没错,这是sql92规范需求,时间精确度极高.
-- TRUNC(SYSDATE) gives us midnight this morning, the start of the day.
-- By using the MINUS operator, we can see which rows are present now but
-- were not present at the start of the day. They might be entirely new
-- employees, or employees whose data was changed today so their row doesn't
-- match the row from yesterday.
DROP TABLE employees_changed_today;
CREATE TABLE employees_changed_today AS
SELECT * FROM employees
MINUS
SELECT * FROM employees AS OF TIMESTAMP TRUNC(SYSDATE);
SELECT TIMESTAMP '1997-01-31 09:26:50.124' FROM dual;
815报错,920通过,与你给的文档完全一致AS OF TIMESTAMP TRUNC(SYSDATE);好像是说在trunc(sysdate)之前所有的记录