-- PostgreSQL
--
-- RCS Revision
--   $Id: preferences.oracle,v 1.1 1999/02/16 15:18:31 roberts Exp $
--
-- Host: localhost    Database: keystone
----------------------------------------------------------

--
-- Table structure for table 'preferences'
--
-- Oracle Table Definition
--
-- RCS Revision
--   $Id: preferences.oracle,v 1.1 1999/02/16 15:18:31 roberts Exp $
--

CREATE SEQUENCE preferences_seq START WITH 1;

CREATE TABLE preferences (
  x_rowid int  DEFAULT 0 PRIMARY KEY,
  pr_uid varchar2(15) NOT NULL,
  pr_tag varchar2(30),
  pr_operator varchar2(5),
  pr_table varchar2(15),
  pr_value varchar2(100)
);

CREATE OR REPLACE TRIGGER preferences_trg_bir
BEFORE INSERT ON preferences
FOR EACH ROW
BEGIN
    IF :new.x_rowid IS NULL OR :new.x_rowid = 0
    THEN
        SELECT preferences_seq.nextval INTO :new.x_rowid FROM dual;
    END IF;
END;
/
