Databases

NAVIGATION
CATEGORIES
REFERRENCE
LINKS
  • order and order line item

    0 answers - 856 bytes - related search similar search Add To My Delicious Add To My Stumble Upon Add To My Google Mark Add To My Facebook Add To My Digg Add To My Reddit

    Suppose we have the usual order & order line item entities:
    CREATE TABLE "order" (
    id INT PRIMARY KEY,
    date DATE NT NULL
    );
    CREATE TABLE orderlineitem (
    id INT PRIMARY KEY,
    orderid INT REFERENCES "order"(id),
    seq INT NT NULL,
    CNSTRAINT con1 UNIQUE (orderid, seq),
    productid INT NT NULL,
    quantity INT NT NULL,
    price NUMERIC(18,4) NT NULL
    );
    how do we enforce things like, for example: a) each order must contain
    at least 1 line item; or b) each order must have a non-zero total value;
    without making INSERT painful? I'm new to triggers, so I'm thinking of
    something like a "before CMMIT" trigger but there's no such thing
    apparently.
    Regards,
    dave
    (end of broadcast)
    TIP 5: don't forget to increase your free space map settings

Re: order and order line item


max 4000 letters.
Your nickname that display:
In order to stop the spam: 6 + 5 =
QUESTION ON "Databases"

EMSDN.COM