On Wed, 2002-12-04 at 04:48, Aitor Imaz wrote:
> The problem
> is that although I know the number of elements the domain should
> contain as of today (two), I can't really tell if this number is going
> to grow in the future (five or six maximum, I'd say). AFAIK, this
> would require me to drop the domain and recreate it with the new set
> of values, which I want to avoid if the database is in production.
> Would an ordinary table + referential integrity be a better solution
> than a domain in this case?

I think so, yes.

> Can domains be altered without needing to
> drop them?

Not according to the manual...

You might want to look at a regular constraint, if you are sure you'll
only have a few values to check. I think this is closer to what you
need. 

Here's an example for WebSQL:

DROP TABLE ctest
//
CREATE TABLE ctest (
  theKey INT DEFAULT SERIAL PRIMARY KEY,
  theTest INT NOT NULL,
  CONSTRAINT testCons CHECK theTest IN (2,4)
)
//
INSERT INTO ctest VALUES (DEFAULT, 4)
//
// this next one will fail
INSERT INTO ctest VALUES (DEFAULT, 6)
//
ALTER TABLE ctest 
  ALTER CONSTRAINT testCons CHECK theTest IN (2,4,6)
//
INSERT INTO ctest VALUES (DEFAULT, 6)



-- 
Richard Barrington <[EMAIL PROTECTED]>

_______________________________________________
sapdb.general mailing list
[EMAIL PROTECTED]
http://listserv.sap.com/mailman/listinfo/sapdb.general

Reply via email to