avatar
database design issue# Database - 数据库
l*k
1
in oracle, I am trying to design a database, I am facing a problem in
preventing duplicate numbers.
I make several table to generate their own PK upon insertion,
some tables's PK will be used as FK by other table(s). How do I
prevent an careless insertion that produce another PK for the
same row??? can I boundle other fields with PK?
If I want to write a scripts that insert FK automatically to other
table upon generation in parent table, then only do updates to those
table, will this be a good s
avatar
a*a
2
dont fully understand your question. but you can create a PK with
more than 1 col.. forgot what's that called now. a com.... pk

【在 l*****k 的大作中提到】
: in oracle, I am trying to design a database, I am facing a problem in
: preventing duplicate numbers.
: I make several table to generate their own PK upon insertion,
: some tables's PK will be used as FK by other table(s). How do I
: prevent an careless insertion that produce another PK for the
: same row??? can I boundle other fields with PK?
: If I want to write a scripts that insert FK automatically to other
: table upon generation in parent table, then only do updates to those
: table, will this be a good s

avatar
m*c
3

Why don't you create a single table to keep track the PK - This table will
have only one column - ID, and everytime you need to create a new PK for any
table, just take the value of ID and then increase it by 1 (so next time you
will get different value), this way, every PK will be unqiue cross whole
schema.

【在 l*****k 的大作中提到】
: in oracle, I am trying to design a database, I am facing a problem in
: preventing duplicate numbers.
: I make several table to generate their own PK upon insertion,
: some tables's PK will be used as FK by other table(s). How do I
: prevent an careless insertion that produce another PK for the
: same row??? can I boundle other fields with PK?
: If I want to write a scripts that insert FK automatically to other
: table upon generation in parent table, then only do updates to those
: table, will this be a good s

avatar
l*k
4
My auto_increment PK is implemented by sequence, there are several
sequences that keep track of different PKs in different table.
all the confusion is generated by user request, they strongly
ask for parallel use of their naming system... I will reformulate
my question later...
right now, I am having problem with my trigger generating script, some
trigger compile with error, while some went through fine... really weird

【在 m**c 的大作中提到】
:
: Why don't you create a single table to keep track the PK - This table will
: have only one column - ID, and everytime you need to create a new PK for any
: table, just take the value of ID and then increase it by 1 (so next time you
: will get different value), this way, every PK will be unqiue cross whole
: schema.

相关阅读
logo
联系我们隐私协议©2024 redian.news
Redian新闻
Redian.news刊载任何文章,不代表同意其说法或描述,仅为提供更多信息,也不构成任何建议。文章信息的合法性及真实性由其作者负责,与Redian.news及其运营公司无关。欢迎投稿,如发现稿件侵权,或作者不愿在本网发表文章,请版权拥有者通知本网处理。