範例 :
WITH job AS
(SELECT wdj.wip_entity_name,
wdj.wip_entity_id,
wo.operation_seq_num,
wdj.status_type_disp
FROM wip_discrete_jobs_v wdj,
wip_operations_v wo
WHERE wdj.organization_id = 00
AND wdj.class_code = 'XX'
AND wdj.wip_entity_id = wo.wip_entity_id),
po AS
(SELECT pd.wip_entity_id,
pd.wip_operation_seq_num,
poh.segment1,
poh.terms_id,
poh.vendor_id,
poh.vendor_site_id,
poh.currency_code,
poh.po_header_id,
poh.type_lookup_code,
poh.approved_flag,
poh.closed_code,
pol.closed_code line_closed_code,
pll.cancel_flag line_cancel_flag,
poh.frozen_flag,
poh.user_hold_flag,
pol.expiration_date,
pol.cancel_flag
FROM po_distributions_all pd,
po_line_locations_all pll,
po_lines_all pol,
po_headers_all poh
WHERE pd.line_location_id = pll.line_location_id
AND pll.po_line_id = pol.po_line_id
AND pol.po_header_id = poh.po_header_id)
SELECT job.wip_entity_name "Job Number",
job.status_type_disp "Job Status",
po.currency_code "Currency",
po_totals_po_sv.get_po_total(X_header_id => po.po_header_id) "Total Amout",
wip_osp.is_order_open(approved_flag => po.approved_flag,
closed_code => po.closed_code,
line_closed_status => po.closed_code,
cancel_flag => po.cancel_flag,
frozen_flag => po.frozen_flag,
user_hold_flag => po.user_hold_flag,
line_expiration_date => po.expiration_date,
line_cancel_flag => po.cancel_flag) "Purchase is opened?"
FROM job,
po
WHERE job.wip_entity_id = po.wip_entity_id(+)
AND job.operation_seq_num = po.wip_operation_seq_num(+)
沒有留言:
張貼留言