ORA-01847 problem [message #637023] |
Thu, 07 May 2015 14:55 |
|
bobghw
Messages: 34 Registered: July 2012
|
Member |
|
|
I have one field that is varchhar2 that holds a date as yyyymmdd "20150508".
I need to subtract this from a date field that holds a date as dd/mm/yyyy "01/05/2015"
Have tried various things but still get the ORA-01847 error msg.
select to_date(mw_onset_date,'dd/mm/yyyy')as mw_onset_date,
trunc(mws_last_update_date) as mws_last_update_date,
trunc(mws_last_update_date)-to_date(mw_onset_date,'dd/mm/yyyy') as DaysBetween,
pt_code
from
(
SELECT
substr(mw.mw_onset_date,7,2)||'/'||substr(mw.mw_onset_date,5,2)||'/'||substr(mw.mw_onset_date,1,4) as mw_onset_date,
trunc(mw.mws_last_update_date) as mws_last_update_date,
c.pt_code
FROM
K_MWREG mw, k_cpireg c
WHERE
c.pt_code = mw.pt_code
and mws_last_update_date is not null
and substr(mw.mw_onset_date,5,2) <> 00
ORDER BY
mw.mw_onset_date desc
)sub
where mw_onset_date is not null
and mw_onset_date > to_date('01/01/2009','dd/mm/2015')
|
|
|
|
|
|
|
|
|
|
|
|
|