<?xml version="1.0" encoding="UTF-8"?>
<rss xmlns:content="http://purl.org/rss/1.0/modules/content/" xmlns:dc="http://purl.org/dc/elements/1.1/" version="2.0">
  <channel>
    <title>experience</title>
    <link>http://www.gojade.com.au/tags/experience/</link>
    <description />
    <language>en</language>
    <copyright>Hendrik</copyright>
    <pubDate>Fri, 16 Aug 2013 01:39:00 GMT</pubDate>
    <dc:creator>Hendrik</dc:creator>
    <dc:date>2013-08-16T01:39:00Z</dc:date>
    <dc:language>en</dc:language>
    <dc:rights>Hendrik</dc:rights>
    <image>
      <title>experience</title>
      <url>http://www.gojade.com.au/tags/experience/</url>
    </image>
    <item>
      <title>Finding dodgy numbers stored in an Oracle varchar field</title>
      <link>http://www.gojade.com.au/2012/03/15/1331785997156.html</link>
      <content:encoded>&lt;p&gt;
I was recently required to process a large amount of data using Oracle - and for whatever reason - a field that was to be interpreted as a number was actually stored as a varchar. Which although not ideal, is generally fine of course until some non-numeric characters find there way into that field. When the table contains a few million records - how do you easily identify the offending records?
&lt;/p&gt;
&lt;p&gt;Below is the simple script I used...&lt;/p&gt;

&lt;code&gt;&lt;pre&gt;
declare
CURSOR c1 IS SELECT * FROM my_table;
n number;
BEGIN
 FOR r1 IN c1 LOOP
   begin
    n := To_Number(r1.offending_field);
   EXCEPTION
     WHEN OTHERS THEN
       dbms_output.put_line('bad='||r1.offending_field);
   END;
 END LOOP;
END;
&lt;/pre&gt;&lt;/code&gt;&lt;p&gt;&lt;a href="http://www.gojade.com.au/entryToPDF.action?entry=1331785997156" title="Export Finding dodgy numbers stored in an Oracle varchar field - Using Oracle 'dbms_output' as PDF document"&gt;&lt;img src="common/images/pdf_logo.gif" alt="Export this post as PDF document" align="bottom" border="0" /&gt;&lt;/a&gt;&amp;nbsp;&amp;nbsp;Export this post to PDF document&lt;/p&gt;</content:encoded>
      <category domain="http://www.gojade.com.au/tags/bucket/">bucket</category>
      <category domain="http://www.gojade.com.au/tags/cursor/">cursor</category>
      <category domain="http://www.gojade.com.au/tags/dbms_output/">dbms_output</category>
      <category domain="http://www.gojade.com.au/tags/experience/">experience</category>
      <category domain="http://www.gojade.com.au/tags/oracle/">oracle</category>
      <category domain="http://www.gojade.com.au/tags/varchar/">varchar</category>
      <pubDate>Thu, 15 Mar 2012 04:33:17 GMT</pubDate>
      <guid isPermaLink="false">tag:www.gojade.com.au,2012-03-15:default/1331785997156</guid>
      <dc:date>2012-03-15T04:33:17Z</dc:date>
    </item>
  </channel>
</rss>

