Advertisement

10.12.2005 at 09:14AM PDT, ID: 21592577
[x]
Attachment Details

Question regarding Sequences and Reboot of machine.

Asked by sinner in Oracle Database

Hello,
I understand that I can create sequences to insert values into a Table (Oracle 10g).

But the sequence number gets lost when the server reboots, which causes problems. How can the sequence be seeded to the actual value?

Something like
 
Create sequence sysID
increment By 1
start with (select MAX(id) from tbl1)

The other option would be to do an insert - select like
select max(id)+1 into nextId from tbl1;
insert into tbl1 (id, name) values (nextid,'some name');

But this does not guarantee that the nextID is unique, what if some one else executes this at the same millisecond?

Thanks

Start Free Trial
[+][-]10.12.2005 at 09:16AM PDT, ID: 15070305

View this solution now by starting your 7-day free trial. Setting up your free trial is quick, easy, and secure. We will return you to this solution, unlocked, when you're done.

 

About this solution

Zone: Oracle Database
Sign Up Now!
Solution Provided By: angelIII
Participating Experts: 2
Solution Grade: A
 
 
[+][-]10.12.2005 at 09:29AM PDT, ID: 15070414

At Experts Exchange, members can ask their questions to thousands of technology professionals, also known as Experts. Experts compete and collaborate to answer those questions by leaving comments like this one.

Start your 7-day free trial to view this Expert Comment or ask the Experts your question.

 
[+][-]10.12.2005 at 09:33AM PDT, ID: 15070447

Often, when Experts are collaborating with members who have asked questions, they will request additional information about the problem. Askers respond with an author comment like this one.

Start your 7-day free trial to view this Author Comment or ask the Experts your question.

 
[+][-]10.12.2005 at 10:19AM PDT, ID: 15070847

Often, when Experts are collaborating with members who have asked questions, they will request additional information about the problem. Askers respond with an author comment like this one.

Start your 7-day free trial to view this Author Comment or ask the Experts your question.

 
[+][-]10.12.2005 at 10:31AM PDT, ID: 15070951

At Experts Exchange, members can ask their questions to thousands of technology professionals, also known as Experts. Experts compete and collaborate to answer those questions by leaving comments like this one.

Start your 7-day free trial to view this Expert Comment or ask the Experts your question.

 
 
Loading Advertisement...
20080716-EE-VQP-32