<?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: How to Create Auto Increment Columns in Oracle</title>
	<atom:link href="http://www.lifeaftercoffee.com/2006/02/17/how-to-create-auto-increment-columns-in-oracle/feed/" rel="self" type="application/rss+xml" />
	<link>http://www.lifeaftercoffee.com/2006/02/17/how-to-create-auto-increment-columns-in-oracle/</link>
	<description>because I don't believe in life before coffee...</description>
	<lastBuildDate>Wed, 28 Oct 2009 06:44:36 -0700</lastBuildDate>
	<generator>http://wordpress.org/?v=2.8.4</generator>
	<sy:updatePeriod>hourly</sy:updatePeriod>
	<sy:updateFrequency>1</sy:updateFrequency>
		<item>
		<title>By: Phil</title>
		<link>http://www.lifeaftercoffee.com/2006/02/17/how-to-create-auto-increment-columns-in-oracle/comment-page-2/#comment-375195</link>
		<dc:creator>Phil</dc:creator>
		<pubDate>Thu, 01 Oct 2009 19:16:36 +0000</pubDate>
		<guid isPermaLink="false">http://www.lifeaftercoffee.com/2006/02/17/how-to-create-auto-increment-columns-in-oracle/#comment-375195</guid>
		<description>This is fantastic. Thanks for making it so simple!</description>
		<content:encoded><![CDATA[<p>This is fantastic. Thanks for making it so simple!</p>
]]></content:encoded>
	</item>
	<item>
		<title>By: rainer</title>
		<link>http://www.lifeaftercoffee.com/2006/02/17/how-to-create-auto-increment-columns-in-oracle/comment-page-2/#comment-375193</link>
		<dc:creator>rainer</dc:creator>
		<pubDate>Thu, 01 Oct 2009 12:19:42 +0000</pubDate>
		<guid isPermaLink="false">http://www.lifeaftercoffee.com/2006/02/17/how-to-create-auto-increment-columns-in-oracle/#comment-375193</guid>
		<description>... found a working solution:
&lt;code&gt;
String generatedColumns[] = {&quot;ID&quot;};
PreparedStatement st = conn.prepareStatement(sql, generatedColumns);
&lt;/code&gt;
...
&lt;code&gt;
if (st.executeUpdate() != 0)
{
    ResultSet rs = st.getGeneratedKeys();
    if (rs.next())
        int idValue = rs.getInt(1);
}
&lt;/code&gt;</description>
		<content:encoded><![CDATA[<p>&#8230; found a working solution:<br />
<code><br />
String generatedColumns[] = {"ID"};<br />
PreparedStatement st = conn.prepareStatement(sql, generatedColumns);<br />
</code><br />
&#8230;<br />
<code><br />
if (st.executeUpdate() != 0)<br />
{<br />
    ResultSet rs = st.getGeneratedKeys();<br />
    if (rs.next())<br />
        int idValue = rs.getInt(1);<br />
}<br />
</code></p>
]]></content:encoded>
	</item>
	<item>
		<title>By: rainer</title>
		<link>http://www.lifeaftercoffee.com/2006/02/17/how-to-create-auto-increment-columns-in-oracle/comment-page-2/#comment-375189</link>
		<dc:creator>rainer</dc:creator>
		<pubDate>Wed, 30 Sep 2009 14:42:32 +0000</pubDate>
		<guid isPermaLink="false">http://www.lifeaftercoffee.com/2006/02/17/how-to-create-auto-increment-columns-in-oracle/#comment-375189</guid>
		<description>this code is just i&#039;ve searched for, thanks.
I need help in getting the generated value using java:

CREATE TABLE person (ID NUMBER(11) NOT NULL, givenName NVARCHAR2(60) default &#039;A default value&#039; NOT NULL, surName NVARCHAR2(60) NOT NULL, CONSTRAINT person_pk PRIMARY KEY ( ID ) ) ORGANIZATION INDEX;

&lt;code&gt;
String sql = &quot;insert into person (givenName,surName) values (?,?)&quot;;
PreparedStatement st = conn.prepareStatement(sql,Statement.RETURN_GENERATED_KEYS);
st.setString(1,&quot;me&quot;);
st.setString(2,&quot;fromMars&quot;);
st.executeUpdate();
ResultSet rs = st.getGeneratedKeys();
if (rs.next()) {
    Object obj = rs.getObject();
}
&lt;/code&gt;

The returned Object is a ROWID, and i&#039;m not able to get the ID for the inserted row.</description>
		<content:encoded><![CDATA[<p>this code is just i&#8217;ve searched for, thanks.<br />
I need help in getting the generated value using java:</p>
<p>CREATE TABLE person (ID NUMBER(11) NOT NULL, givenName NVARCHAR2(60) default &#8216;A default value&#8217; NOT NULL, surName NVARCHAR2(60) NOT NULL, CONSTRAINT person_pk PRIMARY KEY ( ID ) ) ORGANIZATION INDEX;</p>
<p><code><br />
String sql = "insert into person (givenName,surName) values (?,?)";<br />
PreparedStatement st = conn.prepareStatement(sql,Statement.RETURN_GENERATED_KEYS);<br />
st.setString(1,"me");<br />
st.setString(2,"fromMars");<br />
st.executeUpdate();<br />
ResultSet rs = st.getGeneratedKeys();<br />
if (rs.next()) {<br />
    Object obj = rs.getObject();<br />
}<br />
</code></p>
<p>The returned Object is a ROWID, and i&#8217;m not able to get the ID for the inserted row.</p>
]]></content:encoded>
	</item>
	<item>
		<title>By: mona</title>
		<link>http://www.lifeaftercoffee.com/2006/02/17/how-to-create-auto-increment-columns-in-oracle/comment-page-2/#comment-373448</link>
		<dc:creator>mona</dc:creator>
		<pubDate>Thu, 04 Jun 2009 17:50:23 +0000</pubDate>
		<guid isPermaLink="false">http://www.lifeaftercoffee.com/2006/02/17/how-to-create-auto-increment-columns-in-oracle/#comment-373448</guid>
		<description>this code works perfectly right up until i delete a row from the table and start adding new rows.. the sequence starts jumping numbers.. help! any suggestions would be appreciated!</description>
		<content:encoded><![CDATA[<p>this code works perfectly right up until i delete a row from the table and start adding new rows.. the sequence starts jumping numbers.. help! any suggestions would be appreciated!</p>
]]></content:encoded>
	</item>
	<item>
		<title>By: DebiPrasad</title>
		<link>http://www.lifeaftercoffee.com/2006/02/17/how-to-create-auto-increment-columns-in-oracle/comment-page-2/#comment-372958</link>
		<dc:creator>DebiPrasad</dc:creator>
		<pubDate>Wed, 29 Apr 2009 19:09:17 +0000</pubDate>
		<guid isPermaLink="false">http://www.lifeaftercoffee.com/2006/02/17/how-to-create-auto-increment-columns-in-oracle/#comment-372958</guid>
		<description>in the trigger code whats the meaning of that &quot;dual&quot;  word</description>
		<content:encoded><![CDATA[<p>in the trigger code whats the meaning of that &#8220;dual&#8221;  word</p>
]]></content:encoded>
	</item>
	<item>
		<title>By: keepitmassive</title>
		<link>http://www.lifeaftercoffee.com/2006/02/17/how-to-create-auto-increment-columns-in-oracle/comment-page-1/#comment-372496</link>
		<dc:creator>keepitmassive</dc:creator>
		<pubDate>Mon, 09 Mar 2009 08:47:56 +0000</pubDate>
		<guid isPermaLink="false">http://www.lifeaftercoffee.com/2006/02/17/how-to-create-auto-increment-columns-in-oracle/#comment-372496</guid>
		<description>Thanks for a great article, that helped me a lot!</description>
		<content:encoded><![CDATA[<p>Thanks for a great article, that helped me a lot!</p>
]]></content:encoded>
	</item>
	<item>
		<title>By: Vara Prasad</title>
		<link>http://www.lifeaftercoffee.com/2006/02/17/how-to-create-auto-increment-columns-in-oracle/comment-page-1/#comment-372195</link>
		<dc:creator>Vara Prasad</dc:creator>
		<pubDate>Tue, 17 Feb 2009 03:21:12 +0000</pubDate>
		<guid isPermaLink="false">http://www.lifeaftercoffee.com/2006/02/17/how-to-create-auto-increment-columns-in-oracle/#comment-372195</guid>
		<description>good idea............. Thank u.</description>
		<content:encoded><![CDATA[<p>good idea&#8230;&#8230;&#8230;&#8230;. Thank u.</p>
]]></content:encoded>
	</item>
	<item>
		<title>By: Jon Emmons</title>
		<link>http://www.lifeaftercoffee.com/2006/02/17/how-to-create-auto-increment-columns-in-oracle/comment-page-1/#comment-369998</link>
		<dc:creator>Jon Emmons</dc:creator>
		<pubDate>Tue, 26 Aug 2008 02:08:17 +0000</pubDate>
		<guid isPermaLink="false">http://www.lifeaftercoffee.com/2006/02/17/how-to-create-auto-increment-columns-in-oracle/#comment-369998</guid>
		<description>S.

If you want to have the same character appear before each sequence number all you need to do is concatenate the letter in the trigger like this:

SELECT &#039;A&#039; &#124;&#124; test_sequence.nextval INTO :NEW.ID FROM dual;

If you&#039;re looking to increment the leading letter you&#039;re going to have to get a bit trickier.  Maybe others will have ideas, but something like a switch may be in order.

Hope this helps.</description>
		<content:encoded><![CDATA[<p>S.</p>
<p>If you want to have the same character appear before each sequence number all you need to do is concatenate the letter in the trigger like this:</p>
<p>SELECT &#8216;A&#8217; || test_sequence.nextval INTO :NEW.ID FROM dual;</p>
<p>If you&#8217;re looking to increment the leading letter you&#8217;re going to have to get a bit trickier.  Maybe others will have ideas, but something like a switch may be in order.</p>
<p>Hope this helps.</p>
]]></content:encoded>
	</item>
	<item>
		<title>By: S.Anugraha</title>
		<link>http://www.lifeaftercoffee.com/2006/02/17/how-to-create-auto-increment-columns-in-oracle/comment-page-1/#comment-369990</link>
		<dc:creator>S.Anugraha</dc:creator>
		<pubDate>Mon, 25 Aug 2008 08:49:56 +0000</pubDate>
		<guid isPermaLink="false">http://www.lifeaftercoffee.com/2006/02/17/how-to-create-auto-increment-columns-in-oracle/#comment-369990</guid>
		<description>hey,wot do i do, if i need to generate a number sequence with character prefixes,say I need to auto increment the column &#039;Product_id&#039; for every product inserted??</description>
		<content:encoded><![CDATA[<p>hey,wot do i do, if i need to generate a number sequence with character prefixes,say I need to auto increment the column &#8216;Product_id&#8217; for every product inserted??</p>
]]></content:encoded>
	</item>
	<item>
		<title>By: Kalpesh Suryawanshi</title>
		<link>http://www.lifeaftercoffee.com/2006/02/17/how-to-create-auto-increment-columns-in-oracle/comment-page-1/#comment-369734</link>
		<dc:creator>Kalpesh Suryawanshi</dc:creator>
		<pubDate>Fri, 08 Aug 2008 09:46:50 +0000</pubDate>
		<guid isPermaLink="false">http://www.lifeaftercoffee.com/2006/02/17/how-to-create-auto-increment-columns-in-oracle/#comment-369734</guid>
		<description>Hey, this article is really helpful.</description>
		<content:encoded><![CDATA[<p>Hey, this article is really helpful.</p>
]]></content:encoded>
	</item>
</channel>
</rss>
