Hello,
I am trying to update some varchar2 fields, which are storing dates. I
am trying to set a 'to date' with the next minumum from date i.e
from date | to date
01/01/1901 01/01/1902
01/01/1902 01/01/1903
01/01/1903 etc......
I have got a bit lost in creating my update statement, but cannot
understand why I am geting the following error message:-
ora-01847 day of month must be between 1 and last day of month.
The sql is:-
update emp_add_info_va lues_tab a
set free_column10 = (select b.free_column9
from emp_add_info_va lues_tab b
where a.add_info_type = 'B MED INS'
and a.free_column4 not in ('N','W')
and a.emp_no = b.emp_no
and b.add_info_type = 'B MED INS'
and to_date(b.free_ column9,'DD/MM/RR') =
(select min(to_date(c.f ree_column9,'DD/MM/RR')) from
emp_add_info_va lues_tab c
where c.add_info_type = 'B MED INS'
and c.free_column4 not in ('N','W')
and a.emp_no = c.emp_no
and to_date(c.free_ column9,'DD/MM/RR') >
to_date(a.free_ column9,'DD/MM/RR')))
where exists(select b.free_column9
from emp_add_info_va lues_tab b
where a.add_info_type = 'B MED INS'
and a.free_column4 not in ('N','W')
and a.emp_no = b.emp_no
and b.add_info_type = 'B MED INS'
and to_date(b.free_ column9,'DD/MM/RR') =
(select min(to_date(c.f ree_column9,'DD/MM/RR')) from
emp_add_info_va lues_tab c
where c.add_info_type = 'B MED INS'
and c.free_column4 not in ('N','W')
and a.emp_no = c.emp_no
and to_date(c.free_ column9,'DD/MM/RR') >
to_date(a.free_ column9,'DD/MM/RR')))
Any help would be greatly appreciated...
Cheers,
Simon
I am trying to update some varchar2 fields, which are storing dates. I
am trying to set a 'to date' with the next minumum from date i.e
from date | to date
01/01/1901 01/01/1902
01/01/1902 01/01/1903
01/01/1903 etc......
I have got a bit lost in creating my update statement, but cannot
understand why I am geting the following error message:-
ora-01847 day of month must be between 1 and last day of month.
The sql is:-
update emp_add_info_va lues_tab a
set free_column10 = (select b.free_column9
from emp_add_info_va lues_tab b
where a.add_info_type = 'B MED INS'
and a.free_column4 not in ('N','W')
and a.emp_no = b.emp_no
and b.add_info_type = 'B MED INS'
and to_date(b.free_ column9,'DD/MM/RR') =
(select min(to_date(c.f ree_column9,'DD/MM/RR')) from
emp_add_info_va lues_tab c
where c.add_info_type = 'B MED INS'
and c.free_column4 not in ('N','W')
and a.emp_no = c.emp_no
and to_date(c.free_ column9,'DD/MM/RR') >
to_date(a.free_ column9,'DD/MM/RR')))
where exists(select b.free_column9
from emp_add_info_va lues_tab b
where a.add_info_type = 'B MED INS'
and a.free_column4 not in ('N','W')
and a.emp_no = b.emp_no
and b.add_info_type = 'B MED INS'
and to_date(b.free_ column9,'DD/MM/RR') =
(select min(to_date(c.f ree_column9,'DD/MM/RR')) from
emp_add_info_va lues_tab c
where c.add_info_type = 'B MED INS'
and c.free_column4 not in ('N','W')
and a.emp_no = c.emp_no
and to_date(c.free_ column9,'DD/MM/RR') >
to_date(a.free_ column9,'DD/MM/RR')))
Any help would be greatly appreciated...
Cheers,
Simon
Comment