Oracle inserts query data from one table into another table
Insert Into T_idd_event_history (detectorcode, detectorname, loopcode, subeventtype, description, occuretime, releasetime)
Select T. detectorid, T. detectorname, T. loopcode, T. subeventtype, T. Description, T. updatetime, sysdate From T_iid_event_current t
Oracle SQL date comparison:
Before today:
Select * From Up_date Where Update < To_date ( ' 2007-09-07 00:00:00 ' , ' Yyyy-mm-dd hh24: MI: SS ' )
Select * From Up_date Where Update <= To_date ( ' 2007-09-07 00:00:00 ' , ' Yyyy-mm-dd hh24: MI: SS ' )
After today:
Select * From Up_date Where Update > To_date ( ' 2007-09-07 00:00:00 ' , ' Yyyy-mm-dd hh24: MI: SS ' )
Select * From Up_date Where Update > = To_date ( ' 2007-09-07 00:00:00 ' , ' Yyyy-mm-dd hh24: MI: SS ' )
Exact time:
Select * From Up_date Where Update = To_date ( ' 2007-09-07 00:00:00 ' , ' Yyyy-mm-dd hh24: MI: SS ' )
In a certain period of time:
Select * From Up_date Where Update Between To_date ( ' 00:00:00 ' , ' Yyyy-mm-dd hh24: MI: SS ' ) And To_date ( ' 2007-09-07 00:00:00 ' , ' Yyyy-mm-dd hh24: MI: SS ' )
Select * From Up_date Where Update < To_date ( ' 2007-09-07 00:00:00 ' , ' Yyyy-mm-dd hh24: MI: SS ' ) And Update > To_date ( ' 00:00:00 ' , ' Yyyy-mm-dd hh24: MI: SS ' )
Select * From Up_date Where Update <= To_date ( ' 2007-09-07 00:00:00 ' , ' Yyyy-mm-dd hh24: MI: SS ' ) And Update > = To_date ( ' 00:00:00 ' , ' Yyyy-mm-dd hh24: MI: SS ' )