INTELLIGENT WORK FORUMS
FOR COMPUTER PROFESSIONALS

Log In

Come Join Us!

Are you a
Computer / IT professional?
Join Tek-Tips Forums!
  • Talk With Other Members
  • Be Notified Of Responses
    To Your Posts
  • Keyword Search
  • One-Click Access To Your
    Favorite Forums
  • Automated Signatures
    On Your Posts
  • Best Of All, It's Free!

*Tek-Tips's functionality depends on members receiving e-mail. By joining you are opting in to receive e-mail.

Posting Guidelines

Promoting, selling, recruiting, coursework and thesis posting is forbidden.

Jobs

Materialized View (Fast Refresh) How to?

Materialized View (Fast Refresh) How to?

(OP)
I am trying to make a materialized view fast refreshable. It works for inserts on the base table but not for deletes and updates.

Here is the code to create the MV Log.
CREATE MATERIALIZED VIEW LOG ON commerfj.tdl_test
WITH ROWID,
PRIMARY KEY,
SEQUENCE (TX_ID,DETAIL_TYPE,POST_DATE,AMOUNT,PATIENT_AMOUNT,INSURANCE_AMOUNT,ORIGINAL_PAYOR_ID,CUR_PAYOR_ID)
INCLUDING NEW VALUES;

Here is the base table description.
CREATE TABLE COMMERFJ.TDL_TEST
(
TDL_ID NUMBER(16) NOT NULL,
TX_ID NUMBER(38),
POST_DATE DATE,
DETAIL_TYPE NUMBER(38) NOT NULL,
AMOUNT NUMBER(12,2),
PATIENT_AMOUNT NUMBER(12,2),
INSURANCE_AMOUNT NUMBER(12,2),
ORIGINAL_PAYOR_ID NUMBER(38),
CUR_PAYOR_ID NUMBER(38)
)

Here is the MV query.
select
tx_id,
min(rowid) as test_rowid,
min(tdl_id) as tdl_id,
max(case when detail_type = 1 then post_date else null end) as post_date,
sum(amount) as amount,
sum(patient_amount) as patient_amount,
sum(case when detail_type in (20) then amount else 0 end) as payment_amount,
sum(case when detail_type in (21) then amount else 0 end) as adj_amount,
sum(case when detail_type in (1,40,41) then insurance_amount else 0 end) as insurance_amount,
count(amount) as cnt_amt,
count(patient_amount) as cnt_pat,
count(case when detail_type in (20) then amount else 0 end) as cnt_payamt,
count(case when detail_type in (21) then amount else 0 end) as cnt_adj,
count(case when detail_type in (1,40,41) then insurance_amount else 0 end) as cnt_ins,
min(original_payor_id) as original_payor_id,
max(cur_payor_id) as cur_payor_id,
count(*) as cnt
FROM commerfj.tdl_test
group by
tx_id

When I try a delete on the base table, I an error.
ORA-32314: REFRESH FAST of "COMMERFJ"."MV_TDL_TEST" unsupported after deletes/updates.

Can somebody help me get this to work. Thank you.

Red Flag This Post

Please let us know here why this post is inappropriate. Reasons such as off-topic, duplicates, flames, illegal, vulgar, or students posting their homework.

Red Flag Submitted

Thank you for helping keep Tek-Tips Forums free from inappropriate posts.
The Tek-Tips staff will check this out and take appropriate action.

Reply To This Thread

Posting in the Tek-Tips forums is a member-only feature.

Click Here to join Tek-Tips and talk with other members!

Resources

Close Box

Join Tek-Tips® Today!

Join your peers on the Internet's largest technical computer professional community.
It's easy to join and it's free.

Here's Why Members Love Tek-Tips Forums:

Register now while it's still free!

Already a member? Close this window and log in.

Join Us             Close