Oracle FAQ Your Portal to the Oracle Knowledge Grid
HOME | ASK QUESTION | ADD INFO | SEARCH | E-MAIL US
 

Home -> Community -> Usenet -> comp.databases.theory -> Re: tracking shipments, inventory

Re: tracking shipments, inventory

From: <ak_tiredofspam_at_yahoo.com>
Date: 27 Dec 2004 07:23:33 -0800
Message-ID: <1104161013.605067.148520@f14g2000cwb.googlegroups.com>


>> negative stock quantities are entirely
possible in this database design but impossible in the real world (putting aside the issue of backorders). Sure I can add logic in procs and triggers to prevent a negative stock situation.... but that's the burdensome and worrisome part. WHAT IF there's a hole in that logic? How do I make bombproof rules to enforce these sorts of temporal constraints?
...<<

I'd create a table shipment_piece(shipment_pk not null, delivered_to_pk), one row per a piece. You'd use up some more space, but never ever get negative quantities in stock:

select count(*) from shipment_piece where delivered_to_pk is null

This query never returns negative numbers. And yes, if the pieces are not distinguishable, that refers to a well know 'cat food' problem. Received on Mon Dec 27 2004 - 09:23:33 CST

Original text of this message

HOME | ASK QUESTION | ADD INFO | SEARCH | E-MAIL US