<?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: Oracle Data Types &#8211; 5 FAQs About Number</title>
	<atom:link href="http://database-geek.com/2009/03/13/oracle-data-types-5-faqs-about-number/feed/" rel="self" type="application/rss+xml" />
	<link>http://database-geek.com/2009/03/13/oracle-data-types-5-faqs-about-number/</link>
	<description>Database Stuff, from a Geek</description>
	<lastBuildDate>Tue, 15 Feb 2011 16:33:32 +0000</lastBuildDate>
	<sy:updatePeriod>hourly</sy:updatePeriod>
	<sy:updateFrequency>1</sy:updateFrequency>
	<generator>http://wordpress.org/?v=3.3.1</generator>
	<item>
		<title>By: Ben</title>
		<link>http://database-geek.com/2009/03/13/oracle-data-types-5-faqs-about-number/comment-page-1/#comment-687</link>
		<dc:creator>Ben</dc:creator>
		<pubDate>Fri, 18 Sep 2009 22:09:20 +0000</pubDate>
		<guid isPermaLink="false">http://database-geek.com/2009/03/13/oracle-data-types-5-faqs-about-number/#comment-687</guid>
		<description>p.s. I can&#039;t post here from Firefox, it tells me I failed math :(

p.p.s. In my previous post, the middle argument to the lpad should be the desired length (I formatted in angle brackets so it got swallowed).</description>
		<content:encoded><![CDATA[<p>p.s. I can&#8217;t post here from Firefox, it tells me I failed math <img src='http://database-geek.com/wp-includes/images/smilies/icon_sad.gif' alt=':(' class='wp-smiley' /> </p>
<p>p.p.s. In my previous post, the middle argument to the lpad should be the desired length (I formatted in angle brackets so it got swallowed).</p>
]]></content:encoded>
	</item>
	<item>
		<title>By: Ben</title>
		<link>http://database-geek.com/2009/03/13/oracle-data-types-5-faqs-about-number/comment-page-1/#comment-686</link>
		<dc:creator>Ben</dc:creator>
		<pubDate>Fri, 18 Sep 2009 22:02:36 +0000</pubDate>
		<guid isPermaLink="false">http://database-geek.com/2009/03/13/oracle-data-types-5-faqs-about-number/#comment-686</guid>
		<description>If &#039;001&#039; and &#039;00001&#039; represent different accounts, in my opinion it should be called an &quot;account code&quot; or &quot;account id&quot; rather than &quot;account number&quot;, given that it&#039;s not a number.

Also, if you don&#039;t want alphabetic characters to appear in your account numbers but you store as varchar, you really should be adding an additional check constraint, which is a pain if what you really want is a number.

If I had account numbers that really were numeric, but I wanted to format with leading zeros in some contexts, I&#039;d store them as number and do lpad(accountnumber, , &#039;0&#039;), perhaps in a calculated column.


Cheers,
Ben</description>
		<content:encoded><![CDATA[<p>If &#8217;001&#8242; and &#8217;00001&#8242; represent different accounts, in my opinion it should be called an &#8220;account code&#8221; or &#8220;account id&#8221; rather than &#8220;account number&#8221;, given that it&#8217;s not a number.</p>
<p>Also, if you don&#8217;t want alphabetic characters to appear in your account numbers but you store as varchar, you really should be adding an additional check constraint, which is a pain if what you really want is a number.</p>
<p>If I had account numbers that really were numeric, but I wanted to format with leading zeros in some contexts, I&#8217;d store them as number and do lpad(accountnumber, , &#8217;0&#8242;), perhaps in a calculated column.</p>
<p>Cheers,<br />
Ben</p>
]]></content:encoded>
	</item>
	<item>
		<title>By: pras99</title>
		<link>http://database-geek.com/2009/03/13/oracle-data-types-5-faqs-about-number/comment-page-1/#comment-90</link>
		<dc:creator>pras99</dc:creator>
		<pubDate>Tue, 17 Mar 2009 16:41:54 +0000</pubDate>
		<guid isPermaLink="false">http://database-geek.com/2009/03/13/oracle-data-types-5-faqs-about-number/#comment-90</guid>
		<description>Hello, what is better for a primary key column, for example table departments with primary key dep_id?  varchar or number????

What you advice me??

pd: I&#039;m newbie in Oracle DB.</description>
		<content:encoded><![CDATA[<p>Hello, what is better for a primary key column, for example table departments with primary key dep_id?  varchar or number????</p>
<p>What you advice me??</p>
<p>pd: I&#8217;m newbie in Oracle DB.</p>
]]></content:encoded>
	</item>
	<item>
		<title>By: Lewi</title>
		<link>http://database-geek.com/2009/03/13/oracle-data-types-5-faqs-about-number/comment-page-1/#comment-86</link>
		<dc:creator>Lewi</dc:creator>
		<pubDate>Sun, 15 Mar 2009 16:16:57 +0000</pubDate>
		<guid isPermaLink="false">http://database-geek.com/2009/03/13/oracle-data-types-5-faqs-about-number/#comment-86</guid>
		<description>JT,

I completely disagree with that though.  If you aren&#039;t doing math, why are you trimming 0&#039;s?  The fact that the value has leading zeroes means that it is part of the data.

Account numbers have leading zeroes.  An account number with 3 leading zeroes is different that one with 2 leading zeroes.  If it were stored as a number, they would appear to be the same.

I have run into exactly that situation where the modeler decided to create account numbers as number because they were numeric.  We had to retrofit varchar2 all over the place.

I stand by that: if you aren&#039;t doing math, don&#039;t store it as a number.

Thanks for the comment.

LewisC</description>
		<content:encoded><![CDATA[<p>JT,</p>
<p>I completely disagree with that though.  If you aren&#8217;t doing math, why are you trimming 0&#8242;s?  The fact that the value has leading zeroes means that it is part of the data.</p>
<p>Account numbers have leading zeroes.  An account number with 3 leading zeroes is different that one with 2 leading zeroes.  If it were stored as a number, they would appear to be the same.</p>
<p>I have run into exactly that situation where the modeler decided to create account numbers as number because they were numeric.  We had to retrofit varchar2 all over the place.</p>
<p>I stand by that: if you aren&#8217;t doing math, don&#8217;t store it as a number.</p>
<p>Thanks for the comment.</p>
<p>LewisC</p>
]]></content:encoded>
	</item>
	<item>
		<title>By: Oracle Data Types - 5 FAQs About Number &#124; Database Geek Blog</title>
		<link>http://database-geek.com/2009/03/13/oracle-data-types-5-faqs-about-number/comment-page-1/#comment-84</link>
		<dc:creator>Oracle Data Types - 5 FAQs About Number &#124; Database Geek Blog</dc:creator>
		<pubDate>Fri, 13 Mar 2009 16:34:46 +0000</pubDate>
		<guid isPermaLink="false">http://database-geek.com/2009/03/13/oracle-data-types-5-faqs-about-number/#comment-84</guid>
		<description>[...] Oracle Data Types - 5 FAQs About Number &#124; Database Geek Blog [...]</description>
		<content:encoded><![CDATA[<p>[...] Oracle Data Types &#8211; 5 FAQs About Number | Database Geek Blog [...]</p>
]]></content:encoded>
	</item>
	<item>
		<title>By: JT</title>
		<link>http://database-geek.com/2009/03/13/oracle-data-types-5-faqs-about-number/comment-page-1/#comment-83</link>
		<dc:creator>JT</dc:creator>
		<pubDate>Fri, 13 Mar 2009 16:19:07 +0000</pubDate>
		<guid isPermaLink="false">http://database-geek.com/2009/03/13/oracle-data-types-5-faqs-about-number/#comment-83</guid>
		<description>I don&#039;t think I agree with this part in the last Q &quot;If you are not doing math (or if the values are not used as mathematical values), store the value in a VARCHAR2.&quot; 

If its a number, store it as a number.  Period.  Otherwise you get stuff like 1, 0001, 0000001, etc.  

Then you get developers asking why they&#039;re getting a full table scan on select * from foo where trim(leading &#039;0&#039; from a) = 1

Treating numbers as strings almost always leads to headaches later.

My only gripe - Good info!</description>
		<content:encoded><![CDATA[<p>I don&#8217;t think I agree with this part in the last Q &#8220;If you are not doing math (or if the values are not used as mathematical values), store the value in a VARCHAR2.&#8221; </p>
<p>If its a number, store it as a number.  Period.  Otherwise you get stuff like 1, 0001, 0000001, etc.  </p>
<p>Then you get developers asking why they&#8217;re getting a full table scan on select * from foo where trim(leading &#8217;0&#8242; from a) = 1</p>
<p>Treating numbers as strings almost always leads to headaches later.</p>
<p>My only gripe &#8211; Good info!</p>
]]></content:encoded>
	</item>
</channel>
</rss>

