Wednesday, May 11, 2016

Sql Querys regarding Order Management

-- Query to check all orders uploaded  with details

select h.price_list_id,r.customer_number,r.customer_name,h.sold_to_org_id,h.cust_po_number, 'PO# '||h.cust_po_number ,'SO# '||h.order_number,h.attribute1,h.attribute10
,h.booked_flag,''''||h.header_id||''''||',',to_char(h.creation_date,'MM-DD-YYYY HH:MI:SS')
from oe_order_headers_all h, ra_customers r
where h.sold_to_org_id = r.customer_id
and to_char(h.creation_date,'MMDDYYYY')='05112016'-- >
--and h.orig_sys_document_ref like ' '
--and r.customer_name like' ';
--and h.open_flag='Y'
--and h.booked_flag='N'
--and r.customer_number in( )
--and h.attribute10 is null
order by h.creation_date desc;

--Query to check Interface Details before uploading into Oracle 

select rc.customer_number,rc.customer_name,h.error_flag, count(orig_sys_document_ref)
from oe_headers_iface_all h, ra_customers rc
where
--sold_to_org_id=1191 and
--h.creation_date >'17-jan-09'
h.customer_number=rc.customer_number
--and h.error_flag is null
--and h.error_flag ='Y'
group by rc.customer_name,rc.customer_number,rc.customer_id,h.error_flag
order by rc.customer_name;

No comments:

Post a Comment