<?xml version="1.0" encoding="UTF-8"?><rss version="2.0"
	xmlns:content="http://purl.org/rss/1.0/modules/content/"
	xmlns:dc="http://purl.org/dc/elements/1.1/"
	xmlns:atom="http://www.w3.org/2005/Atom"
	xmlns:sy="http://purl.org/rss/1.0/modules/syndication/"
		>
<channel>
	<title>Comments on: DB utilities &#8211; updating sequences the elegant way</title>
	<atom:link href="http://technology.amis.nl/2005/05/23/db-utilities-updating-sequences-the-elegant-way/feed/" rel="self" type="application/rss+xml" />
	<link>http://technology.amis.nl/2005/05/23/db-utilities-updating-sequences-the-elegant-way/?utm_source=rss&#038;utm_medium=rss&#038;utm_campaign=db-utilities-updating-sequences-the-elegant-way</link>
	<description></description>
	<lastBuildDate>Fri, 12 Apr 2013 10:04:09 +0000</lastBuildDate>
	<sy:updatePeriod>hourly</sy:updatePeriod>
	<sy:updateFrequency>1</sy:updateFrequency>
	<generator>http://wordpress.org/?v=3.5.1</generator>
	<item>
		<title>By: Marco</title>
		<link>http://technology.amis.nl/2005/05/23/db-utilities-updating-sequences-the-elegant-way/#comment-2137</link>
		<dc:creator>Marco</dc:creator>
		<pubDate>Mon, 23 May 2005 17:31:38 +0000</pubDate>
		<guid isPermaLink="false">/?p=572#comment-2137</guid>
		<description><![CDATA[Nice thinking

See also &lt;a href=http://www.orafaq.com/scripts/sql/set_sequence.txt rel=&quot;nofollow&quot;&gt;set_sequence.txt&lt;/a&gt; for inspiration]]></description>
		<content:encoded><![CDATA[<p>Nice thinking</p>
<p>See also <a href=http://www.orafaq.com/scripts/sql/set_sequence.txt rel="nofollow">set_sequence.txt</a> for inspiration</p>
]]></content:encoded>
	</item>
	<item>
		<title>By: Marcos</title>
		<link>http://technology.amis.nl/2005/05/23/db-utilities-updating-sequences-the-elegant-way/#comment-2136</link>
		<dc:creator>Marcos</dc:creator>
		<pubDate>Mon, 23 May 2005 11:38:51 +0000</pubDate>
		<guid isPermaLink="false">/?p=572#comment-2136</guid>
		<description><![CDATA[Hello Gert-Jan

A nice dynamic solution but what about the following:

-- select the max value from the table
Select the max_value into lMaxVal from table;
--select the sequence number from the sequence
Select sequence_name.nextval into lSeqNr from dual;
-- change the increment of the sequence
Execute immediate (&#039;alter sequence sequence_name increment by &#039;&#124;&#124;( lMaxVal-lSeqNr));
-- select a value from the sequence
select sequence_name.next_val into lSeqNr from dual;
-- reset the increment of the sequence
Execute immediate (&#039;alter sequence sequence_name increment by 1&#039;);

If you implement this in your package you do not have to recreate/grant etc on the sequence and the sequence would not create
invalid objects.

Cheers Marcos]]></description>
		<content:encoded><![CDATA[<p>Hello Gert-Jan</p>
<p>A nice dynamic solution but what about the following:</p>
<p>&#8211; select the max value from the table<br />
Select the max_value into lMaxVal from table;<br />
&#8211;select the sequence number from the sequence<br />
Select sequence_name.nextval into lSeqNr from dual;<br />
&#8211; change the increment of the sequence<br />
Execute immediate (&#8216;alter sequence sequence_name increment by &#8216;||( lMaxVal-lSeqNr));<br />
&#8211; select a value from the sequence<br />
select sequence_name.next_val into lSeqNr from dual;<br />
&#8211; reset the increment of the sequence<br />
Execute immediate (&#8216;alter sequence sequence_name increment by 1&#8242;);</p>
<p>If you implement this in your package you do not have to recreate/grant etc on the sequence and the sequence would not create<br />
invalid objects.</p>
<p>Cheers Marcos</p>
]]></content:encoded>
	</item>
</channel>
</rss>
