-
Sequences
Hi everybody,
Do I have to create for every table in the databsase a sequence in order to have values for the primary fields or there is some other way to that?
-
Yes, this is the common way.
Of course, you can create a script to do it for you.
Tomaž
"A common mistake that people make when trying to design something completely
foolproof is to underestimate the ingenuity of complete fools" - Douglas Adams
-
sequences
-
Hi,
CREATE SEQUENCE MY_SEQ START WITH 100
INCREMENT BY 1
NOMAXVALUE
NOCYCLE
CACHE 20;
Its upto you to give the values,,or else it will take the default values.
HTH
SS
-
Create your sequence
Code:
CREATE SEQUENCE atable_s
START WITH 1
INCREMENT BY 1
NOMAXVALUE;
Then use the sequence in your insert statements
Code:
INSERT INTO atable.col
VALUES (atable_s.nextval);
HTH
Jim
Oracle Certified Professional
"Build your reputation by helping other people build theirs."
"Sarcasm may be the lowest form of wit but its still funny"
Click HERE to vist my website!
-
Re: Sequences
Originally posted by edli
Do I have to create for every table in the databsase a sequence in order to have values for the primary fields or there is some other way to that?
It is possible to use one sequence for all tables, if you can live with gaps in primary keys. There's no requirement for table to have its own sequence.
Ales The whole difference between a little boy and an adult man is the price of toys
-
Originally posted by TomazZ
Yes, this is the common way.
Of course, you can create a script to do it for you.
No, If the database is designed properly all tables should have primary key column/s. Why to create dummy primary key values ?
Sanjay G.
Oracle Certified Professional 8i, 9i.
"The degree of normality in a database is inversely proportional to that of its DBA"
-
If the database is designed properly all tables should have primary key column/s. Why to create dummy primary key values ?
hey I think u answered your own question
-
Sanjay G.
Oracle Certified Professional 8i, 9i.
"The degree of normality in a database is inversely proportional to that of its DBA"
-
Just to show that for every rule there is an exception, let me mention that in a data warehouse or DW fact table there is generally no requirement to define a PK, synthetic or otherwise, if the table os not the parent of another.
Posting Permissions
- You may not post new threads
- You may not post replies
- You may not post attachments
- You may not edit your posts
-
Forum Rules
|
Click Here to Expand Forum to Full Width
|