Wednesday, October 15, 2008

Script to reset OM Records, while performing the conversions using interface approach

UNDEFINE NEW_SOURCE_ID
UNDEFINE OLD_SOURCE_ID

select s.order_source_id, substrb(s.name,1,20)
from oe_order_sources s;

select s.order_source_id, substrb(s.name,1,20) source, count(distinct h.header_id) headers
from oe_order_headers_all h,
oe_order_sources s
where h.order_source_id = s.order_source_id
group by s.order_source_id, s.name;

update oe_order_headers_all
set order_source_id = &&NEW_SOURCE_ID
where order_source_id = &&OLD_SOURCE_ID;

update oe_order_lines_all
set order_source_id = &&NEW_SOURCE_ID
where order_source_id = &&OLD_SOURCE_ID;

select s.order_source_id, substrb(s.name,1,20) source, count(distinct h.header_id) headers
from oe_order_headers_all h,
oe_order_sources s
where h.order_source_id = s.order_source_id
group by s.order_source_id, s.name;

delete oe_headers_iface_all
where order_source_id = &&OLD_SOURCE_ID;

delete oe_lines_iface_all
where order_source_id = &&OLD_SOURCE_ID;

delete oe_actions_iface_all
where order_source_id = &&OLD_SOURCE_ID;

No comments: