Oracle FAQ | Your Portal to the Oracle Knowledge Grid |
![]() |
![]() |
Home -> Community -> Usenet -> c.d.o.server -> Re: Maintaining Stock Availibility : physical table or materialized view ?
krislioe_at_gmail.com wrote:
> Hi,
> Thanks for your response.
>
>> I fail to see what it is you think a materialized view will do that >> a column named QTY_ON_HAND won't.
Perhaps a bit melodramatic for me to say this but horribly wrong.
You are as likely to make a mistake in creating your materialized view as you are in an update statement and you should eliminate bugs in your code by testing.
In your product table have a column that holds on-hand inventory. With such a small number of transactions a simple:
SELECT *
FROM products
WHERE product_id = someval
FOR update;
UPDATE products
SET qty_on_hand = qty_on_hand + x
WHERE product_id = someval;
or
UPDATE products
SET qty_on_hand = qty_on_hand - x
WHERE product_id = someval;
should be sufficient.
-- Daniel Morgan University of Washington Puget Sound Oracle Users GroupReceived on Thu Sep 07 2006 - 08:33:09 CDT
![]() |
![]() |