- 最后登录
- 2015-5-21
- 在线时间
- 100 小时
- 威望
- 0
- 金钱
- 345
- 注册时间
- 2012-12-19
- 阅读权限
- 10
- 帖子
- 99
- 精华
- 0
- 积分
- 0
- UID
- 824
|
1#
发表于 2013-2-26 14:46:36
|
查看: 3486 |
回复: 1
对于两张表的查询,分别在两张表上基于列和rowid创建日志- CREATE MATERIALIZED VIEW LOG ON ar.ar_distributions_all
- WITH ROWID, SEQUENCE(source_id, org_id, source_table) INCLUDING NEW VALUES;
- CREATE MATERIALIZED VIEW LOG ON ar.ar_receivable_applications_all
- WITH ROWID, SEQUENCE(receivable_application_id
- , org_id, application_type,postable) INCLUDING NEW VALUES;
复制代码 日志创建成功,之后创建物化视图语句报错- CREATE MATERIALIZED VIEW mv_ard_ra
- TABLESPACE APPS_TS_TX_DATA
- BUILD IMMEDIATE
- REFRESH FAST ON COMMIT AS
- Select ARD.source_type,
- ARD.source_type,
- ARD.code_combination_id,
- ARD.currency_code,
- ARD.source_type,
- ARD.currency_code,
- ARD.amount_dr ENTERED_DR,
- ARD.amount_cr ENTERED_CR,
- ARD.acctd_amount_dr ACCOUNTED_DR,
- ARD.acctd_amount_cr ACCOUNTED_CR,
- ARD.currency_conversion_date CURRENCY_CONVERSION_DATE,
- ARD.currency_conversion_type CURRENCY_CONVERSION_TYPE,
- ARD.currency_conversion_rate CURRENCY_CONVERSION_RATE,
- ARD.third_party_id THIRD_PARTY_ID,
- ARD.third_party_sub_id THIRD_PARTY_SUB_ID,
- ARD.source_table SOURCE_TABLE,
- ARD.source_id SOURCE_ID,
- ARD.line_id AEL_ID,
- ARD.last_update_date LAST_UPDATE_DATE,
- ARD.last_updated_by LAST_UPDATED_BY,
- ARD.creation_date CREATION_DATE,
- ARD.created_by CREATED_BY,
- ARD.last_update_login LAST_UPDATE_LOGIN,
- ARD.tax_code_id TAX_CODE_ID,
- ARD.tax_link_id TAX_LINK_ID,
- ARD.taxable_entered_dr TAXABLE_ENTERED_DR,
- ARD.taxable_entered_cr TAXABLE_ENTERED_CR,
- ARD.taxable_accounted_dr TAXABLE_ACCOUNTED_DR,
- ARD.taxable_accounted_cr TAXABLE_ACCOUNTED_CR,
- ra.application_type,
- ra.status,
- RA.gl_date,
- RA.posting_control_id,
- RA.posting_control_id,
- RA.applied_customer_trx_id,
- RA.applied_customer_trx_id,
- RA.apply_date APPLICATION_DATE,
- RA.applied_customer_trx_id APPLIED_TO_TRX_HDR_ID
- From ar_distributions_all ARD, ar_receivable_applications_all RA
- where ARD.source_id = RA.receivable_application_id
- AND nvl(ARD.org_id, -99) = nvl(RA.org_id, -99)
- AND ARD.source_table = 'RA'
- AND RA.application_type = 'CASH'
- AND nvl(RA.postable, 'Y') = 'Y'
复制代码 ora-12052:cannot fast refresh materialized view APPS.MV_ARD_RA
我在底下做实验的时候参考官档- CREATE MATERIALIZED VIEW LOG ON times
- WITH ROWID, SEQUENCE (time_id, calendar_year)
- INCLUDING NEW VALUES;
- CREATE MATERIALIZED VIEW LOG ON products
- WITH ROWID, SEQUENCE (prod_id)
- INCLUDING NEW VALUES;
- CREATE MATERIALIZED VIEW sales_mv
- BUILD IMMEDIATE
- REFRESH FAST ON COMMIT
- AS SELECT t.calendar_year, p.prod_id,
- SUM(s.amount_sold) AS sum_sales
- FROM times t, products p, sales s
- WHERE t.time_id = s.time_id AND p.prod_id = s.prod_id
- GROUP BY t.calendar_year, p.prod_id;
复制代码 我应该根据那几列使用group by 来让该视图能快速刷新(快速刷新我理解应该是有group by吧,不知道对不对)
望大师们指点一二 |
|