Ñêðèïò main_tables.sql

-- *********************************************************************
-- Name: main_tables.sql
-- Purpose:
-- Author: Vladimir Begun
-- $Id$
-- TODO: XXX

PROMPT Pseudo-production tables...

SET FEEDBACK OFF

CREATE TABLE operation ( -- operations
p NUMBER
, fkey_payment NUMBER
--- other columns definition
, CONSTRAINT c$op$p PRIMARY KEY (p)
, CONSTRAINT c$op$fkey_payment FOREIGN KEY (fkey_payment) REFERENCES lookup(p)
, CONSTRAINT c$op$proper_category CHECK (TRUNC(fkey_payment / &category_limit) = &category_payment)
) STORAGE (MINEXTENTS 1 MAXEXTENTS 1 PCTINCREASE 0 INITIAL 8K)
/

CREATE TABLE account ( -- operations
p NUMBER
, fkey_currency NUMBER
--- other columns definition
, CONSTRAINT c$ac$p PRIMARY KEY (p)
, CONSTRAINT c$ac$fkey_currency FOREIGN KEY (fkey_currency) REFERENCES lookup(p)
, CONSTRAINT c$ac$proper_category CHECK (TRUNC(fkey_currency / &category_limit) = &category_currency)
) STORAGE (MINEXTENTS 1 MAXEXTENTS 1 PCTINCREASE 0 INITIAL 8K)
/

CREATE TABLE person ( -- persons
p NUMBER
, fkey_sex NUMBER
--- other columns definition
, CONSTRAINT c$pr$p PRIMARY KEY (p)
, CONSTRAINT c$pr$fkey_sex FOREIGN KEY (fkey_sex) REFERENCES lookup(p)
, CONSTRAINT c$pr$proper_category CHECK (TRUNC(fkey_sex / &category_limit) = &category_sex)
) STORAGE (MINEXTENTS 1 MAXEXTENTS 1 PCTINCREASE 0 INITIAL 8K)
/

SET FEEDBACK OFF