I need help fast! I have a multi-level SQL statement connected by a number of unions. When I paste it into a SQL editor such as TOAD or DBArtisan and run it against Oracle, it runs great and I get all the records I expect to get. However, when I create a brand new report in CR 10 and paste the exact same query in the "Add Command" window, I get zero records. Here is my SQL statement (forgive me, it's long):
select
user_id,
workitem_id,
decode(status, 20, 'complete', 50, 'Discard', 'none') "STATUS",
to_char(complete_date, 'DD-MON-YY HH24:MI:SS') "TIMESTAMP"
from
bcbs_entry
where
status in (20, 50) and
to_date(complete_date) = to_date(sysdate)
union all
select
user_id,
workitem_id,
decode(status, 20, 'complete', 50, 'Discard', 'none') "STATUS",
to_char(complete_date, 'DD-MON-YY HH24:MI:SS') "TIMESTAMP"
from
ref_phys_entry
where
status in (20, 50) and
to_date(complete_date) = to_date(sysdate)
union all
select
user_id,
workitem_id,
decode(status, 20, 'complete', 50, 'Discard', 'none') "STATUS",
to_char(complete_date, 'DD-MON-YY HH24:MI:SS') "TIMESTAMP"
from
mcare_entry
where
status in (20, 50) and
to_date(complete_date) = to_date(sysdate)
union all
select
user_id,
workitem_id,
decode(status, 20, 'complete', 50, 'Discard', 'none') "STATUS",
to_char(complete_date, 'DD-MON-YY HH24:MI:SS') "TIMESTAMP"
from
me_entry
where
status in (20, 50) and
to_date(complete_date) = to_date(sysdate)
union all
select
from_user "USER_ID",
workitem_id,
decode(status, 20, 'complete', 50, 'Discard', 'none') "STATUS",
to_char(cr_date, 'DD-MON-YY HH24:MI:SS') "TIMESTAMP"
from
history
where
to_date(cr_date) = to_date(sysdate) and
status in (20, 50) and
workitem_id in (select workitem_id from man_care_entry where status in (20, 50) and to_date(complete_date) = to_date(sysdate))
union all
select
user_id,
workitem_id,
decode(status, 20, 'complete', 50, 'Discard', 'none') "STATUS",
to_char(complete_date, 'DD-MON-YY HH24:MI:SS') "TIMESTAMP"
from
outpatient_entry
where
status in (20, 50) and
to_date(complete_date) = to_date(sysdate)
union all
select
user_id,
workitem_id,
decode(status, 20, 'complete', 50, 'Discard', 'none') "STATUS",
to_char(complete_date, 'DD-MON-YY HH24:MI:SS') "TIMESTAMP"
from
pre_reg_entry
where
status in (20, 50) and
to_date(complete_date) = to_date(sysdate)
order by
user_id,
timestamp,
workitem_id,
status
HELP!!! Any ideas?
select
user_id,
workitem_id,
decode(status, 20, 'complete', 50, 'Discard', 'none') "STATUS",
to_char(complete_date, 'DD-MON-YY HH24:MI:SS') "TIMESTAMP"
from
bcbs_entry
where
status in (20, 50) and
to_date(complete_date) = to_date(sysdate)
union all
select
user_id,
workitem_id,
decode(status, 20, 'complete', 50, 'Discard', 'none') "STATUS",
to_char(complete_date, 'DD-MON-YY HH24:MI:SS') "TIMESTAMP"
from
ref_phys_entry
where
status in (20, 50) and
to_date(complete_date) = to_date(sysdate)
union all
select
user_id,
workitem_id,
decode(status, 20, 'complete', 50, 'Discard', 'none') "STATUS",
to_char(complete_date, 'DD-MON-YY HH24:MI:SS') "TIMESTAMP"
from
mcare_entry
where
status in (20, 50) and
to_date(complete_date) = to_date(sysdate)
union all
select
user_id,
workitem_id,
decode(status, 20, 'complete', 50, 'Discard', 'none') "STATUS",
to_char(complete_date, 'DD-MON-YY HH24:MI:SS') "TIMESTAMP"
from
me_entry
where
status in (20, 50) and
to_date(complete_date) = to_date(sysdate)
union all
select
from_user "USER_ID",
workitem_id,
decode(status, 20, 'complete', 50, 'Discard', 'none') "STATUS",
to_char(cr_date, 'DD-MON-YY HH24:MI:SS') "TIMESTAMP"
from
history
where
to_date(cr_date) = to_date(sysdate) and
status in (20, 50) and
workitem_id in (select workitem_id from man_care_entry where status in (20, 50) and to_date(complete_date) = to_date(sysdate))
union all
select
user_id,
workitem_id,
decode(status, 20, 'complete', 50, 'Discard', 'none') "STATUS",
to_char(complete_date, 'DD-MON-YY HH24:MI:SS') "TIMESTAMP"
from
outpatient_entry
where
status in (20, 50) and
to_date(complete_date) = to_date(sysdate)
union all
select
user_id,
workitem_id,
decode(status, 20, 'complete', 50, 'Discard', 'none') "STATUS",
to_char(complete_date, 'DD-MON-YY HH24:MI:SS') "TIMESTAMP"
from
pre_reg_entry
where
status in (20, 50) and
to_date(complete_date) = to_date(sysdate)
order by
user_id,
timestamp,
workitem_id,
status
HELP!!! Any ideas?