Pages

Thursday, July 26, 2018

Materialized View

DROP MATERIALIZED VIEW LOG ON ap.ap_suppliers

DROP MATERIALIZED VIEW LOG ON ap.ap_supplier_sites_all

DROP MATERIALIZED VIEW xxexpd_suppliers_mv

CREATE MATERIALIZED VIEW LOG ON ap.ap_suppliers
WITH ROWID,PRIMARY KEY/* SEQUENCE(invoice_num,
                          invoice_currency_code,
  invoice_amount,amount_paid,
  terms_id,
  payment_status_flag ,
  gl_date,
  invoice_date,
  description,
  terms_date)*/
INCLUDING NEW VALUES;

CREATE MATERIALIZED VIEW LOG ON ap.ap_supplier_sites_all
WITH ROWID,PRIMARY KEY/* SEQUENCE(invoice_num,
                          invoice_currency_code,
  invoice_amount,amount_paid,
  terms_id,
  payment_status_flag ,
  gl_date,
  invoice_date,
  description,
  terms_date)*/
INCLUDING NEW VALUES;

CREATE MATERIALIZED VIEW xxexpd_suppliers_mv
BUILD IMMEDIATE
REFRESH FAST ON COMMIT
evaluate using CURRENT EDITION as
(SELECT aps.rowid apsrowid,
                 apss.rowid apssrowid,
aps.vendor_id,
vendor_name,
segment1,
enabled_flag,
employee_id,
vendor_type_lookup_code,
aps.terms_id,
aps.invoice_currency_code,
aps.payment_currency_code,
aps.HOLD_ALL_PAYMENTS_FLAG,
aps.HOLD_FUTURE_PAYMENTS_FLAG,
aps.hold_reason,
start_date_active,
end_date_active ,
vendor_site_id,
vendor_site_code,
org_id,
address_line1,
city,
state,
ZIP,
country
FROM  ap.ap_suppliers aps,
             ap.ap_supplier_sites_all apss
WHERE aps.vendor_id = apss.vendor_id
);

After Creating the logs on the Base tables, the log tables will gets create
e.g. MLOG$_<TABLE_NAME>

update ap_supplier_sites_all
set    address_line1 = address_line1||'3'
where  address_line1 is not null and org_id = 224;

update ap_supplier_sites_all
set    address_line1 = address_line1||'3'
where  address_line1 is not null
and    org_id = 224

select * from DBA_MVIEW_DETAIL_RELATIONS where MVIEW_NAME like 'XXEXPD%'

SELECT * FROM ap.MLOG$_AP_SUPPLIERS

select *from ap.MLOG$_AP_SUPPLIER_SITES_AL

select *from all_objects where object_name like '%$%AP_SUPPLIER_SITES%'

select *from ap.MLOG$_AP_SUPPLIERS

select *from ap.MLOG$_AP_SUPPLIER_SITES_AL

select *from ap.RUPD$_AP_SUPPLIER_SITES_AL

No comments:

Post a Comment