Hi,
Using 11.2.0.3 and have 3 tables 1 with date of arrival in in it and wish to compare this to tables which tell us if item has arrived in time
e.g planned_arrival and actual arrivals are dates assuming planned arrival is 21:00:00 and actual arrival is 21:40:00 and the other table b contains value and unit e.g. 30 as value and unit as Mins such that if actual_arrival > planned_arrival + 30 minutes then late.
If we say planned_arrival + 30 then it adds 30 days to it. If was hard-coded sql could use planned_arrival+ interval '30' minute but how can we do this dynamically - needs to be able to run as sql rather than setting up string and using execute immediate to run dynamic sql.
table2 has different values for each custiomer e.g some coudl be 2 hours, some 30 minutes etc.
select actual_arrival, planned_arrival + target_value
from table1 t
, table2 b
where t.customer = b.owner_name
Thought about using planned_arrival + target/ case when unit = 'Mins' then 1440 when hours etc. which woudl give us what we need but wondreded if better way to achive this.
Thanks