NULL value in multi-column primary key

前端 未结 5 1375
执笔经年
执笔经年 2020-12-29 17:54

I\'ve got a table with several columns making up the primary key. The nature of the data stored allows some of these fields to have NULL values. I have designed

5条回答
  •  别那么骄傲
    2020-12-29 18:08

    Primary key states that column mustn't have NULL values. So columns used for defining composite primary key isn't going to be NULL.

    Also Oracle server compares the combination of all columns used in a composite primary key definition. If your all columns existing data (say x,y) matched with newly adding row, it will raise error of Unique Constraint Violated.

    Moreover,look at this thread: What's wrong with nullable columns in composite primary keys?.

    This link provides valuable information regarding possibility of NULLABLE columns in composite key!

提交回复
热议问题