DBMS_FLASHBACK.ENABLE_AT_TIME : dbms_flashback « System Packages « Oracle PL / SQL






DBMS_FLASHBACK.ENABLE_AT_TIME

 

SQL>
SQL>
SQL> create table ord(
  2           gift_id                    integer         primary key
  3          ,emp_id                integer
  4          ,register_date              date not null
  5          ,total_price                number(7,2)
  6          ,deliver_date               date
  7          ,deliver_time               varchar2(7)
  8          ,payment                    varchar2(2)
  9          ,emp_no                     number(3,0)
 10          ,deliver_name               varchar2(35)
 11          ,message                    varchar2(100)
 12  );

Table created.

SQL> --  order table inserts
SQL> insert into ord(gift_id,emp_id,register_date,total_price,deliver_date,deliver_time,payment,emp_no,deliver_name,message)values
  2                 (1,1,'14-Feb-2009', 123.12, '14-Feb-2009', '12 noon', 'CA',1, null, 'Happy Birthday to you');

1 row created.

SQL> insert into ord(gift_id  ,emp_id ,register_date ,total_price ,deliver_date ,deliver_time ,payment ,emp_no,deliver_name ,message)values
  2                 (2,1,'14-Feb-2009', 50.98, '14-feb-2009', '1 pm', 'CA',7, 'name1', 'Happy Birthday');

1 row created.

SQL> insert into ord(gift_id  ,emp_id ,register_date ,total_price ,deliver_date ,deliver_time,payment ,emp_no,deliver_name ,message )values
  2                 (3, 2,'14-Feb-2009', 35.99, '14-feb-2009', '1 pm', 'VS',2, 'Tom', 'Happy Birthday');

1 row created.

SQL> insert into ord(gift_id  ,emp_id ,register_date ,total_price ,deliver_date ,deliver_time,payment ,emp_no,deliver_name ,message )values
  2                 (4, 2,'14-Feb-2009', 19.95, '14-feb-2009', '5 pm', 'CA',2, 'Mary', 'Happy Birthday');

1 row created.

SQL>
SQL> exec DBMS_FLASHBACK.ENABLE_AT_TIME ( SYSDATE - (1/24) );
BEGIN DBMS_FLASHBACK.ENABLE_AT_TIME ( SYSDATE - (1/24) ); END;

*
ERROR at line 1:
ORA-08183: Flashback cannot be enabled in the middle of a transaction
ORA-06512: at "SYS.DBMS_FLASHBACK", line 3
ORA-06512: at line 1


SQL>
SQL> SELECT * FROM ord;

         1          1 14-FEB-09      123.12 14-FEB-09 12 noon CA          1
Happy Birthday to you

         2          1 14-FEB-09       50.98 14-FEB-09 1 pm    CA          7 name1
Happy Birthday

         3          2 14-FEB-09       35.99 14-FEB-09 1 pm    VS          2 Tom
Happy Birthday

         4          2 14-FEB-09       19.95 14-FEB-09 5 pm    CA          2 Mary
Happy Birthday


4 rows selected.

SQL>
SQL> exec DBMS_FLASHBACK.DISABLE;

PL/SQL procedure successfully completed.

SQL>
SQL> drop table ord;

Table dropped.

SQL>

   
  








Related examples in the same category

1.Enter flashback mode, going back 10 minutes
2.Leave Flashback mode