| Oracle FAQ | Your Portal to the Oracle Knowledge Grid | |
Home -> Community -> Usenet -> comp.databases.theory -> Re: Foreign key
You nmight want to look up matrix methods in accounting. Imagine a
big square matrix with all of your accounts on each axis. The rows in
the grid are debits, the columns are credits. To show movement from
one account to another, you enter an amount in a cell in the grid.
Each transaction has a unique identifier and might put various amounts
in many cells at once.
This is modeled in SQL as:
CREATE TABLE Transactions
(trans_id INTEGER NOT NULL,
debit_acct DECIMAL (8,3) NOT NULL
REFERENCES ChartOfAccounts(acct_nbr)
ON UPDATE CASCADE,
credit_acct DECIMAL (8,3) NOT NULL
REFERENCES ChartOfAccounts(acct_nbr)
ON UPDATE CASCADE,
CHECK (amount >= 0.0000),
PRIMARY KEY (trans_id, debit_acct, credit_acct));
All of your specialized ledgers are VIEWs taken from this table. They are restrict to certain account codes from your Chart of Accounts, which I assume is a heirarchy. Received on Mon Feb 03 2003 - 15:59:58 CST
![]() |
![]() |