SQL Language (MOSC)

MOSC Banner

Query only returns rows from one specific day instead of yesterday

edited Oct 5, 2011 1:36AM in SQL Language (MOSC) 5 commentsAnswered ✓
Hi!
I have this query:

select store_day_seq_no, business_date, store, day, inv_bus_date_ind, inv_store_ind, store_status, data_status, audit_status
from sa_store_day
where to_char(business_date,'yyyymmdd') = to_char(sysdate +(1-to_char(sysdate,'D')),'yyyymmdd')
and data_status = 'R';

The output is used to create a report.

The strange thing is that I ran the query today and yesterday. I got the same output. There must be something wrong with the where clause.

If I run the query today it should return "rows" from yesterday.

How do I fix this?

Howdy, Stranger!

Log In

To view full details, sign in to My Oracle Support Community.

Register

Don't have a My Oracle Support Community account? Click here to get started.

Category Leaderboard

Top contributors this month

New to My Oracle Support Community? Visit our Welcome Center

MOSC Help Center