Skip to Main Content

SQL & PL/SQL

Announcement

For appeals, questions and feedback about Oracle Forums, please email oracle-forums-moderators_us@oracle.com. Technical questions should be asked in the appropriate category. Thank you!

Comparing SQL data in the same table for two different dates

DangellApr 15 2013 — edited Apr 15 2013
Oracle Database 11g Enterprise Edition Release 11.2.0.3.0

Hello,

We have a batch scheduling tool that automatically runs Oracle jobs and when it runs the jobs it stores a record from the instance in a table. I am trying to write a query that pulls up all of the jobs that ran today and compares them with what ran on the same day last week to find out what jobs didnt run today. So far I have the below but I can't get it to return anything. I am using Toad for this
select *
 from xxcar_abat_instances 
where trunc(to_date(start_datetime)) = trunc(sysdate-7) 
  and completion_status = 'Success' 
 AND NOT EXISTS
  (select script_name 
    from xxcar_abat_instances 
   where trunc(to_date(start_datetime)) = trunc(sysdate) 
     and completion_status = 'Success')
Thank you
Comments
Locked Post
New comments cannot be posted to this locked post.
Post Details
Locked on May 13 2013
Added on Apr 15 2013
10 comments
1,444 views