niXforums Forum Index
 FAQFAQ   SearchSearch   MemberlistMemberlist   UsergroupsUsergroups   RegisterRegister 
 ProfileProfile   PreferencesPreferences   Log in to check your private messagesLog in to check your private messages   Log inLog in 
·  nixdoc.net ·  man pages ·  Linux HOWTOs ·  FreeBSD Tips ·  Forums
navigation Forum index » Databases » Oracle
how to refresh a sequence
Post new topic   Reply to topic Page 1 of 1 [2 Posts] View previous topic :: View next topic
Author Message
Rauf Sarwar
*nix forums Guru


Joined: 03 May 2005
Posts: 353

PostPosted: Wed Feb 23, 2005 8:49 am    Post subject: Re: how to refresh a sequence Reply with quote

Robert Wehofer wrote:
Quote:
How could I refresh a sequence in Oracle using an SQL statement?

I've got the problem, that the current number of a sequence is less
the
highest index in a table, where I want to use the sequence.

Regards,
Robert

Either drop and recreate OR

declare
max_value_ number := <max value to increment to>;
currval_ number;
nextval_ number;
begin
loop
select your_seq.currval into currval_ from dual;
if (currval_ >= max_value_) then
exit;
else
select your_seq.nextval into nextval_ from dual;
end if;
end loop;
end;
/

Regards
/Rauf
Back to top
Robert Wehofer
*nix forums beginner


Joined: 08 Feb 2005
Posts: 31

PostPosted: Wed Feb 23, 2005 7:51 am    Post subject: how to refresh a sequence Reply with quote

How could I refresh a sequence in Oracle using an SQL statement?

I've got the problem, that the current number of a sequence is less the
highest index in a table, where I want to use the sequence.

Regards,
Robert
Back to top
Google

Back to top
Display posts from previous:   
Post new topic   Reply to topic Page 1 of 1 [2 Posts] View previous topic :: View next topic
The time now is Thu Jan 08, 2009 6:06 am | All times are GMT
navigation Forum index » Databases » Oracle
Jump to:  

Similar Topics
Topic Author Forum Replies Last Post
No new posts Strange problem with Sequence.. please help.. Krist Server 4 Fri Jul 21, 2006 7:30 am
No new posts Dev Database Refresh Options meathammer Server 3 Wed Jul 19, 2006 10:05 pm
No new posts Refresh loglist in UNIX IT Specialist shell 0 Tue Jul 18, 2006 1:23 am
No new posts pg_restore failes - invalid byte sequence for encoding "U... Oliver Fürst PostgreSQL 2 Mon Jul 17, 2006 1:37 pm
No new posts How to refresh page without prompt the "resend informatio... phforum PHP 10 Mon Jul 17, 2006 4:22 am

Loans | Debt Consolidation | Bankruptcy | Prepaid Credit Cards | Buy Anything On eBay
Copyright © 2004-2005 DeniX Solutions SRL
 
Other DeniX Solutions sites: Unix/Linux blog |  electronics forum |  medicine forum |  science forum | 
Privacy Policy


Powered by phpBB © 2001, 2005 phpBB Group
[ Time: 0.0993s ][ Queries: 20 (0.0330s) ][ GZIP on - Debug on ]