User Tools

Site Tools


validtimetemporal

Differences

This shows you the differences between two versions of the page.

Link to this comparison view

Both sides previous revisionPrevious revision
Next revision
Previous revision
validtimetemporal [2015/07/22 10:06] z0hpvkvalidtimetemporal [2025/03/08 22:24] (current) – external edit 127.0.0.1
Line 1: Line 1:
 ===== Valid Time Temporal ===== ===== Valid Time Temporal =====
 +==== Create Tables ====
 Create a period using existing columns Create a period using existing columns
 <code>CREATE TABLE student_modules ( <code>CREATE TABLE student_modules (
Line 18: Line 19:
   PERIOD FOR student_module_period   PERIOD FOR student_module_period
   );</code>   );</code>
 +
 +==== Viewing Data ====
 We can now create **AS OF PERIOD FOR** queries.\\ We can now create **AS OF PERIOD FOR** queries.\\
 The below query finds all students on a currently active course. The below query finds all students on a currently active course.
Line 25: Line 28:
 <code>SELECT * FROM student_modules VERSIONS PERIOD FOR  <code>SELECT * FROM student_modules VERSIONS PERIOD FOR 
               student_module_period BETWEEN TRUNC(SYSDATE)-7 AND TRUNC(SYSDATE);</code>               student_module_period BETWEEN TRUNC(SYSDATE)-7 AND TRUNC(SYSDATE);</code>
 +              
 +==== Using Flashback ====
 +You can also use the DBMS_FLASHBACK_ARCHIVE.ENABLE_AT_VALID_TIME procedure
 +<code>BEGIN
 +  DBMS_FLASHBACK_ARCHIVE.ENABLE_AT_VALID_TIME ('ASOF','20-JUL-15 12.00.01 PM');
 +END;
 +
 +BEGIN
 +  DBMS_FLASHBACK_ARCHIVE.ENABLE_AT_VALID_TIME ('CURRENT');
 +END;
 +
 +BEGIN
 +  DBMS_FLASHBACK_ARCHIVE.ENABLE_AT_VALID_TIME ('ALL');
 +END;</code>
validtimetemporal.1437559586.txt.gz · Last modified: 2025/03/08 22:23 (external edit)