views:

651

answers:

1

Hi All,

yesterday you had taught me to query record history within a time range here.

What more I need is to add oracle's (historical) timestamp to the results as a column. Is it possible?

Thanks in advance.

+2  A: 

Yes, in fact the answer to your previous question shows how:

SQL> select empno, sal, versions_starttime,versions_xid
  2  from emp
  3  versions between timestamp sysdate-1 and sysdate
  4  where empno=7369;

     EMPNO        SAL VERSIONS_STARTTIME                                                          VERSIONS_XID
---------- ---------- --------------------------------------------------------------------------- --
      7369       5900 11-DEC-08 16.05.32                                                          0014001300002A74
      7369       5800 11-DEC-08 16.03.32                                                          000D002200012EB1
      7369       5800

There is also a VERSIONS_ENDTIME pseudo-column. Between them VERSIONS_STARTTIME and VERSIONS_ENDTIME bracket the period of time during which the change was made.

Tony Andrews
except that I got an "OCI invalid handle" error in toad :-(
Zsolt Botykai
That would be a Toad problem. Try SQL Plus.
Tony Andrews
You are right, thanks again.
Zsolt Botykai