<?xml version="1.0" encoding="UTF-8"?>
<rss version="2.0"
	xmlns:content="http://purl.org/rss/1.0/modules/content/"
	xmlns:wfw="http://wellformedweb.org/CommentAPI/"
	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/"
	xmlns:slash="http://purl.org/rss/1.0/modules/slash/"
	>

<channel>
	<title>A Different Projection</title>
	<atom:link href="http://www.mercatorgeosystems.com/blog/?feed=rss2" rel="self" type="application/rss+xml" />
	<link>http://www.mercatorgeosystems.com/blog</link>
	<description>The Mercator GeoSystems Blog</description>
	<lastBuildDate>Fri, 02 Jul 2010 22:05:58 +0000</lastBuildDate>
	<generator>http://wordpress.org/?v=2.8.4</generator>
	<language>en</language>
	<sy:updatePeriod>hourly</sy:updatePeriod>
	<sy:updateFrequency>1</sy:updateFrequency>
			<item>
		<title>Settings.bundle doesn&#8217;t appear in iPhone Settings</title>
		<link>http://www.mercatorgeosystems.com/blog/?p=70</link>
		<comments>http://www.mercatorgeosystems.com/blog/?p=70#comments</comments>
		<pubDate>Fri, 02 Jul 2010 21:57:15 +0000</pubDate>
		<dc:creator>admin</dc:creator>
				<category><![CDATA[Mac]]></category>
		<category><![CDATA[iPhone]]></category>
		<category><![CDATA[settings.bundle]]></category>
		<category><![CDATA[xcode]]></category>

		<guid isPermaLink="false">http://www.mercatorgeosystems.com/blog/?p=70</guid>
		<description><![CDATA[Hi,
We were working on an iPhone app recently and added a Settings.bundle to allow the user to set their preferences as described here and here.  However whenever we ran the app either on the device or on the simulator the settings simply would not appear in the iPhone&#8217;s settings.
After much digging around and many hours [...]]]></description>
			<content:encoded><![CDATA[<p>Hi,</p>
<p>We were working on an iPhone app recently and added a Settings.bundle to allow the user to <a href="http://developer.apple.com/iphone/library/documentation/preferencesettings/conceptual/settingsapplicationschemareference/Introduction/Introduction.html#//apple_ref/doc/uid/TP40007005-SW1">set their preferences as described here</a> and <a href="http://www.iphonesdkarticles.com/2008/08/application-preferences.html">here</a>.  However whenever we ran the app either on the device or on the simulator the settings simply would not appear in the iPhone&#8217;s settings.</p>
<p>After much digging around and many hours banging heads on walls we finally tracked it down.  Settings bundles are only added to the phone <em>the first time the application is installed<strong>. </strong><span style="font-style: normal;">If you&#8217;ve worked on an application and deployed it to your development device or simulator before adding the settings.bundle to your XCode project then subsequent build and runs won&#8217;t add the settings unless you </span>remove the app from the device or simulator in the usual way.</em> i.e by pressing and holding the app icon and removing it when it starts shaking.</p>
<p>The next time you deploy to the device or simulator the settings should be present.</p>
<p>We hope this helps someone.</p>
]]></content:encoded>
			<wfw:commentRss>http://www.mercatorgeosystems.com/blog/?feed=rss2&amp;p=70</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>Oracle &#8216;isnumeric&#8217; function</title>
		<link>http://www.mercatorgeosystems.com/blog/?p=64</link>
		<comments>http://www.mercatorgeosystems.com/blog/?p=64#comments</comments>
		<pubDate>Thu, 12 Nov 2009 18:51:34 +0000</pubDate>
		<dc:creator>admin</dc:creator>
				<category><![CDATA[Oracle]]></category>
		<category><![CDATA[pl/sql]]></category>

		<guid isPermaLink="false">http://www.mercatorgeosystems.com/blog/?p=64</guid>
		<description><![CDATA[Hello,
To me a simple, yet glaring, omission from the Oracle PL/SQL language, which is in many ways excellent, is a function to test to see if a string represents numeric data as can be found in many other languages (e.g is_numeric in PHP, isNumeric in Java and .Net).
A possible implementation is to simply try to [...]]]></description>
			<content:encoded><![CDATA[<p>Hello,</p>
<p>To me a simple, yet glaring, omission from the Oracle PL/SQL language, which is in many ways excellent, is a function to test to see if a string represents numeric data as can be found in many other languages (e.g is_numeric in PHP, isNumeric in Java and .Net).</p>
<p>A possible implementation is to simply try to assign the string to a number and catch any exceptions.  If something goes wrong then it&#8217;s not a number!</p>
<pre>  create or replace function isnumeric(p_value in varchar2) return number
  as
    l_ret number;
  begin
    -- Try to cast to a number
    begin
      l_ret := to_number(p_value);
      -- if the line above worked then just reset to 1
      l_ret := 1;
    exception
      when others then
        -- Something, anything, went wrong
        l_ret := 0;
    end;
    -- Return
    return l_ret;
  end isnumeric;</pre>
<p>e.g</p>
<pre>  select isnumeric('10.1.1') from dual</pre>
<pre>  select isnumeric('10.1') from dual</pre>
<pre>  select isnumeric('-10.1') from dual</pre>
<p>We hope this helps someone.</p>
]]></content:encoded>
			<wfw:commentRss>http://www.mercatorgeosystems.com/blog/?feed=rss2&amp;p=64</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>Solution to crackling and breaking up conversation on iPhone</title>
		<link>http://www.mercatorgeosystems.com/blog/?p=57</link>
		<comments>http://www.mercatorgeosystems.com/blog/?p=57#comments</comments>
		<pubDate>Tue, 27 Oct 2009 16:29:23 +0000</pubDate>
		<dc:creator>admin</dc:creator>
				<category><![CDATA[Mac]]></category>
		<category><![CDATA[iPhone]]></category>

		<guid isPermaLink="false">http://www.mercatorgeosystems.com/blog/?p=57</guid>
		<description><![CDATA[Hi,
Yesterday one of our iPhones developed an intermittent fault with the call quality.  Often we could hear the other party but they couldn&#8217;t hear us, or vice versa.  It didn&#8217;t seem to matter who initiated the call or wether it was a mobile to landline call or mobile to mobile.
We took the following diagnostic steps [...]]]></description>
			<content:encoded><![CDATA[<p>Hi,</p>
<p>Yesterday one of our iPhones developed an intermittent fault with the call quality.  Often we could hear the other party but they couldn&#8217;t hear us, or vice versa.  It didn&#8217;t seem to matter who initiated the call or wether it was a mobile to landline call or mobile to mobile.</p>
<div id="attachment_58" class="wp-caption aligncenter" style="width: 236px"><img class="size-full wp-image-58" title="iPhone" src="http://www.mercatorgeosystems.com/blog/wp-content/uploads/2009/10/46506673_iphone3gs_3up.jpg" alt="iPhone" width="226" height="170" /><p class="wp-caption-text">iPhone 3G</p></div>
<p>We took the following diagnostic steps to try and track down the problem :</p>
<p>1) Made a sound recording with the Voice Memos app and played it back to confirm speaker / mic working.</p>
<p>2) Powered off and on again</p>
<p>3) Reset (pressed Home and Power button simultaneously for 10 seconds)</p>
<p>4) Did a <a href="http://support.apple.com/kb/HT1414">Restore</a> through iTunes.</p>
<p>All to no effect.  A quick call to O2 resulted in a couple more things to try :</p>
<p>1) Remove SIM card and give it a good clean.  It was surprising how much pocket fluff was in there!</p>
<p>2) Try the SIM card in another phone.</p>
<p>With the second option above we actually found that the other phone (a Nokia) started exhibiting the same behaviour so the problem appeared to be with the SIM, not the iPhone (phew!).</p>
<p>A quick trip to the <a href="http://www.webmap.o2.co.uk/interfaces/retail/">local O2 retail store</a> for a SIM swap (done in the store with no temporary number or delay) and we&#8217;re back up and running again.</p>
<p>We hope this helps someone else.</p>
<p><strong>UPDATE : </strong>the solution may not have been that simple as the problem resurfaced a few days later.  We&#8217;ve just done a complete factory reset and fingers-crossed we&#8217;ll be OK.  Just made a 6 minute call which was impossible this morning.</p>
]]></content:encoded>
			<wfw:commentRss>http://www.mercatorgeosystems.com/blog/?feed=rss2&amp;p=57</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>Missing (red) frameworks in iPhone XCode projects after upgrade</title>
		<link>http://www.mercatorgeosystems.com/blog/?p=43</link>
		<comments>http://www.mercatorgeosystems.com/blog/?p=43#comments</comments>
		<pubDate>Mon, 28 Sep 2009 09:26:00 +0000</pubDate>
		<dc:creator>admin</dc:creator>
				<category><![CDATA[Mac]]></category>
		<category><![CDATA[Frameworks]]></category>
		<category><![CDATA[iPhone]]></category>
		<category><![CDATA[SDK]]></category>
		<category><![CDATA[xcode]]></category>

		<guid isPermaLink="false">http://www.mercatorgeosystems.com/blog/?p=43</guid>
		<description><![CDATA[Hi,
We just upgraded XCode to the latest release (3.1.4 as at time of writing) and noticed that after doing so a number of our iPhone projects now had their Frameworks all set to missing (i.e coloured in red) like this :

The solution wasn&#8217;t immediately obvious but just in case anyone else was wondering what was [...]]]></description>
			<content:encoded><![CDATA[<p style="TEXT-ALIGN: left">Hi,<a href="http://www.mercatorgeosystems.com/blog/wp-content/uploads/2009/09/theproblem.png"></a></p>
<p>We just upgraded XCode to the latest release (3.1.4 as at time of writing) and noticed that after doing so a number of our iPhone projects now had their Frameworks all set to missing (i.e coloured in red) like this :</p>
<p><a href="http://www.mercatorgeosystems.com/blog/wp-content/uploads/2009/09/getprojectinfo.png"></a><img class="aligncenter size-full wp-image-44" title="Missing (red) frameworks" src="http://www.mercatorgeosystems.com/blog/wp-content/uploads/2009/09/redframeworks.png" alt="The problem" width="260" height="349" /></p>
<p>The solution wasn&#8217;t immediately obvious but just in case anyone else was wondering what was required to fix it here are the steps :</p>
<p>1) Open the settings for your project by right-clicking and choosing &#8216;Get Info&#8217; :</p>
<p><a href="http://www.mercatorgeosystems.com/blog/wp-content/uploads/2009/09/getprojectinfo.png"><img class="alignnone size-full wp-image-45" title="getprojectinfo" src="http://www.mercatorgeosystems.com/blog/wp-content/uploads/2009/09/getprojectinfo.png" alt="" width="238" height="220" /></a></p>
<p>2) This will display this page, which will display the root of the problem in the &#8216;Base SDK for all configuration&#8217; drop down :</p>
<p><img class="size-full wp-image-46" title="theproblem" src="http://www.mercatorgeosystems.com/blog/wp-content/uploads/2009/09/theproblem.png" alt="" width="500" height="413" /></p>
<p>The problem is that the project was set to &#8216;iPhone Device 2.2&#8242; which is no longer supplied with XCode.</p>
<p>3) To fix the problem simply change the Base SDK to whatever is appropriate for you, e.g :</p>
<p><a href="http://www.mercatorgeosystems.com/blog/wp-content/uploads/2009/09/newsetting.png"><img class="aligncenter size-full wp-image-47" title="newsetting" src="http://www.mercatorgeosystems.com/blog/wp-content/uploads/2009/09/newsetting.png" alt="" width="499" height="31" /></a></p>
<p>and voila, the problem is solved :</p>
<p><a href="http://www.mercatorgeosystems.com/blog/wp-content/uploads/2009/09/problemsolved.png"><img class="aligncenter size-full wp-image-48" title="problemsolved" src="http://www.mercatorgeosystems.com/blog/wp-content/uploads/2009/09/problemsolved.png" alt="" width="200" height="70" /></a></p>
<p>Thanks for reading.</p>
]]></content:encoded>
			<wfw:commentRss>http://www.mercatorgeosystems.com/blog/?feed=rss2&amp;p=43</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>Returning Oracle SQL data as XML</title>
		<link>http://www.mercatorgeosystems.com/blog/?p=39</link>
		<comments>http://www.mercatorgeosystems.com/blog/?p=39#comments</comments>
		<pubDate>Thu, 24 Sep 2009 09:21:35 +0000</pubDate>
		<dc:creator>admin</dc:creator>
				<category><![CDATA[Oracle]]></category>
		<category><![CDATA[xml]]></category>
		<category><![CDATA[xmlagg]]></category>
		<category><![CDATA[xmlattributes]]></category>
		<category><![CDATA[xmldb]]></category>
		<category><![CDATA[xmlelement]]></category>
		<category><![CDATA[xmlforest]]></category>
		<category><![CDATA[xmlroot]]></category>

		<guid isPermaLink="false">http://www.mercatorgeosystems.com/blog/?p=39</guid>
		<description><![CDATA[Hi
An earlier post illustrated how to extract information from XML inside PL/SQL.  This post is an example of the reverse of this, in that it shows how to create an XML document from a SQL statement.  These examples are based on creating an XML document providing details of the tables in the SCOTT schema but [...]]]></description>
			<content:encoded><![CDATA[<p>Hi</p>
<p>An <a href="http://www.mercatorgeosystems.com/blog/?p=5">earlier post</a> illustrated how to extract information from XML inside PL/SQL.  This post is an example of the reverse of this, in that it shows how to create an XML document from a SQL statement.  These examples are based on creating an XML document providing details of the tables in the SCOTT schema but could easily be adapted to suit your needs.</p>
<p>This first example extract the list of tables names and uses a combination of the XMLRoot, XMLElement, XMLAgg, XMLAttributes and XMLForest functions to create the document :</p>
<pre>SELECT XMLRoot(
         XMLElement("Tables",
           XMLAgg(XMLElement("Table",
             XMLAttributes(table_name),
               XMLForest(owner,
                         tablespace_name,
                         status,
                         num_rows)))</pre>
<pre>       ), VERSION '1.0', STANDALONE YES).getClobVal() as XMLDATA
  from all_tables
 where owner = 'SCOTT'

<span style="font-family: 'Lucida Grande', 'Lucida Sans Unicode', Tahoma, Verdana, sans-serif; line-height: 19px; white-space: normal; font-size: 13px;">This example returns a document like so :</span>
<pre>&lt;?xml version="1.0" standalone="yes"?&gt;
&lt;Tables&gt;
  &lt;Table TABLE_NAME="DEPT"&gt;
    &lt;OWNER&gt;SCOTT&lt;/OWNER&gt;
    &lt;TABLESPACE_NAME&gt;USERS&lt;/TABLESPACE_NAME&gt;
    &lt;STATUS&gt;VALID&lt;/STATUS&gt;
    &lt;NUM_ROWS&gt;4&lt;/NUM_ROWS&gt;
    &lt;/Table&gt;</pre>
<p><span style="font-family: 'Lucida Grande', 'Lucida Sans Unicode', Tahoma, Verdana, sans-serif; line-height: 19px; white-space: normal; font-size: 13px;">etc etc.</span></p>
<p><span style="font-family: 'Lucida Grande', 'Lucida Sans Unicode', Tahoma, Verdana, sans-serif;"><span style="line-height: 19px; white-space: normal; font-size: x-small;"><span style="font-size: small;">To make this a little more useful (and complex!) we can add a nested query to return the column details in-line with the table information, like this :</span></span></span></p>
<pre>SELECT XMLRoot(
         XMLElement("Tables",
          XMLAgg(XMLElement("Table",
             XMLAttributes(at.table_name),
               XMLForest(at.owner,
                         at.tablespace_name,
                         at.status,
                         at.num_rows,
                         (select XMLAgg(XMLElement("Column",
                                   XMLAttributes(atc.column_name),
                                     XMLForest(atc.data_type,
                                               atc.data_length,
                                               atc.data_scale,
                                               atc.data_precision,
                                               atc.nullable)))
                           from all_tab_columns atc
                          where atc.owner = at.owner
                            and atc.table_name = at.table_name) as columns)))
         ), VERSION '1.0', STANDALONE YES).getClobVal() as XMLDATA
  from all_tables at
 where owner = 'SCOTT'</pre>
<p><span style="font-family: 'Lucida Grande', 'Lucida Sans Unicode', Tahoma, Verdana, sans-serif;"><span style="line-height: 19px; white-space: normal;">which returns an XML document like so :</span></span></p>
<pre>&lt;?xml version="1.0" standalone="yes"?&gt;
&lt;Tables&gt;
  &lt;Table TABLE_NAME="DEPT"&gt;
    &lt;OWNER&gt;SCOTT&lt;/OWNER&gt;
    &lt;TABLESPACE_NAME&gt;USERS&lt;/TABLESPACE_NAME&gt;
    &lt;STATUS&gt;VALID&lt;/STATUS&gt;
    &lt;NUM_ROWS&gt;4&lt;/NUM_ROWS&gt;
    &lt;COLUMNS&gt;
      &lt;Column COLUMN_NAME="DEPTNO"&gt;
        &lt;DATA_TYPE&gt;NUMBER&lt;/DATA_TYPE&gt;
        &lt;DATA_LENGTH&gt;22&lt;/DATA_LENGTH&gt;
        &lt;DATA_SCALE&gt;0&lt;/DATA_SCALE&gt;
        &lt;DATA_PRECISION&gt;2&lt;/DATA_PRECISION&gt;
        &lt;NULLABLE&gt;N&lt;/NULLABLE&gt;
      &lt;/Column&gt;
      &lt;Column COLUMN_NAME="DNAME"&gt;
        &lt;DATA_TYPE&gt;VARCHAR2&lt;/DATA_TYPE&gt;
        &lt;DATA_LENGTH&gt;14&lt;/DATA_LENGTH&gt;
        &lt;NULLABLE&gt;Y&lt;/NULLABLE&gt;
      &lt;/Column&gt;
      &lt;Column COLUMN_NAME="LOC"&gt;
       &lt;DATA_TYPE&gt;VARCHAR2&lt;/DATA_TYPE&gt;
       &lt;DATA_LENGTH&gt;13&lt;/DATA_LENGTH&gt;
       &lt;NULLABLE&gt;Y&lt;/NULLABLE&gt;
     &lt;/Column&gt;
  &lt;/COLUMNS&gt;
&lt;/TABLE&gt;</pre>
<pre><span style="font-family: 'Lucida Grande', 'Lucida Sans Unicode', Tahoma, Verdana, sans-serif; line-height: 19px; white-space: normal;">etc etc.</span></pre>
<pre><span style="font-family: 'Lucida Grande', 'Lucida Sans Unicode', Tahoma, Verdana, sans-serif; line-height: 19px; white-space: normal;">I hope this is helpful to someone.  Most of the documentation that supports this post can be found <a href="http://download.oracle.com/docs/cd/B19306_01/appdev.102/b14259/xdb13gen.htm">here</a>.</span></pre>
</pre>
]]></content:encoded>
			<wfw:commentRss>http://www.mercatorgeosystems.com/blog/?feed=rss2&amp;p=39</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>Creating and using primary keys on views in Oracle</title>
		<link>http://www.mercatorgeosystems.com/blog/?p=38</link>
		<comments>http://www.mercatorgeosystems.com/blog/?p=38#comments</comments>
		<pubDate>Wed, 02 Sep 2009 21:56:15 +0000</pubDate>
		<dc:creator>admin</dc:creator>
				<category><![CDATA[Oracle]]></category>
		<category><![CDATA[disable]]></category>
		<category><![CDATA[foreign key]]></category>
		<category><![CDATA[novalidate]]></category>
		<category><![CDATA[primary key]]></category>
		<category><![CDATA[view]]></category>

		<guid isPermaLink="false">http://www.mercatorgeosystems.com/blog/?p=38</guid>
		<description><![CDATA[Hi,
Occasionally it may be useful to have a primary / foreign key relationship between a view and table, where the view is the primary key referenced by a column in the table.
Oracle doesn&#8217;t let you do this quite as &#8216;completely&#8217; as we&#8217;d probably like, but it at least let&#8217;s you put in the building blocks [...]]]></description>
			<content:encoded><![CDATA[<p>Hi,</p>
<p>Occasionally it may be useful to have a primary / foreign key relationship between a view and table, where the view is the primary key referenced by a column in the table.</p>
<p>Oracle doesn&#8217;t let you do this quite as &#8216;completely&#8217; as we&#8217;d probably like, but it at least let&#8217;s you put in the building blocks which may help the CBO and make your database design more concise or elegant in places.</p>
<p>Here is a quick example :</p>
<pre>SQL&gt; create view pk_view</pre>
<pre>(item_id, item_name,</pre>
<pre>constraint pk_test_view primary key (item_id) rely disable novalidate)<span style="font-family: 'Lucida Grande', 'Lucida Sans Unicode', Tahoma, Verdana, sans-serif; line-height: 19px; white-space: normal; font-size: 13px;"> </span></pre>
<pre>as</pre>
<pre>select 1, 'One' from dual</pre>
<pre>union</pre>
<pre>select 2, 'Two' from dual</pre>
<pre>union</pre>
<pre>select 3, 'Three' from dual;</pre>
<pre>View created.</pre>
<pre>SQL&gt; create table fk_view (</pre>
<pre>item_id number references pk_view disable novalidate);</pre>
<pre>Table created.</pre>
<pre>SQL&gt;</pre>
<p>There, that&#8217;s it.  Hope this helps someone as the create view syntax can be a little tricky.</p>
]]></content:encoded>
			<wfw:commentRss>http://www.mercatorgeosystems.com/blog/?feed=rss2&amp;p=38</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>Use grep to match on the beginning of a line</title>
		<link>http://www.mercatorgeosystems.com/blog/?p=37</link>
		<comments>http://www.mercatorgeosystems.com/blog/?p=37#comments</comments>
		<pubDate>Tue, 09 Jun 2009 19:19:54 +0000</pubDate>
		<dc:creator>admin</dc:creator>
				<category><![CDATA[Shell scripts]]></category>
		<category><![CDATA[grep]]></category>
		<category><![CDATA[linux]]></category>
		<category><![CDATA[shell script]]></category>
		<category><![CDATA[text]]></category>
		<category><![CDATA[unix]]></category>

		<guid isPermaLink="false">http://www.mercatorgeosystems.com/blog/?p=37</guid>
		<description><![CDATA[Hi
Just a simple one but a syntax that I can never remember when I need to so a quick post may help jog mine, and your, memory.  This grep syntax is for matching lines from a text file that begin with a particular word or expression :
$ grep -w '^Word' input_file.txt &#62; output_file.txt
This will search input_file.txt [...]]]></description>
			<content:encoded><![CDATA[<p>Hi</p>
<p>Just a simple one but a syntax that I can never remember when I need to so a quick post may help jog mine, and your, memory.  This grep syntax is for matching lines from a text file that begin with a particular word or expression :</p>
<pre>$ grep -w '^Word' input_file.txt &gt; output_file.txt</pre>
<div>This will search input_file.txt for lines that begin with &#8216;Word&#8217; and then redirect the output to output_file.txt.</div>
]]></content:encoded>
			<wfw:commentRss>http://www.mercatorgeosystems.com/blog/?feed=rss2&amp;p=37</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>oui.exe crash on Oracle 10.2.0.4 patch</title>
		<link>http://www.mercatorgeosystems.com/blog/?p=36</link>
		<comments>http://www.mercatorgeosystems.com/blog/?p=36#comments</comments>
		<pubDate>Tue, 12 May 2009 18:33:20 +0000</pubDate>
		<dc:creator>admin</dc:creator>
				<category><![CDATA[Oracle]]></category>
		<category><![CDATA[10.2.0.4]]></category>
		<category><![CDATA[10g]]></category>
		<category><![CDATA[patch]]></category>
		<category><![CDATA[windows]]></category>

		<guid isPermaLink="false">http://www.mercatorgeosystems.com/blog/?p=36</guid>
		<description><![CDATA[This is just a simple little post but one which was frustrating for us for a while earlier today.  When trying to run setup.exe to install the 10.2.0.4 patchset for Oracle 10g on a Windows XP Pro machine (this may happen on other flavours of Windows, I&#8217;m not sure) it pretty much immediately crashed with [...]]]></description>
			<content:encoded><![CDATA[<p>This is just a simple little post but one which was frustrating for us for a while earlier today.  When trying to run setup.exe to install the 10.2.0.4 patchset for Oracle 10g on a Windows XP Pro machine (this may happen on other flavours of Windows, I&#8217;m not sure) it pretty much immediately crashed with an error in oui.exe.</p>
<p>After much digging it turns out that the problem is simply that the path from which the setup.exe was ran had a space in it (as it was just on the Desktop so was actually in C:\Documents and Settings\&lt;user&gt;\Desktop.  Simply moving the file to a folder with no spaces (e.g C:\temp) fixed the issue and the upgrade proceeded as you would expect.</p>
]]></content:encoded>
			<wfw:commentRss>http://www.mercatorgeosystems.com/blog/?feed=rss2&amp;p=36</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>Returning an SQL result to a Shell script</title>
		<link>http://www.mercatorgeosystems.com/blog/?p=34</link>
		<comments>http://www.mercatorgeosystems.com/blog/?p=34#comments</comments>
		<pubDate>Tue, 10 Mar 2009 10:55:32 +0000</pubDate>
		<dc:creator>admin</dc:creator>
				<category><![CDATA[Oracle]]></category>
		<category><![CDATA[Shell scripts]]></category>
		<category><![CDATA[shell script]]></category>
		<category><![CDATA[sqlplus]]></category>

		<guid isPermaLink="false">http://www.mercatorgeosystems.com/blog/?p=34</guid>
		<description><![CDATA[Hi
Often it can be useful to return the result of a simple SQL*Plus query to a shell script variable, for example to check for a value before deciding wether or not to proceed.  The syntax is actually pretty simple :
#!/bin/sh
count=$(sqlplus -s 'scott/tiger@xe'&#60;&#60;EOF
  set pages 0 feed off
  select count(*) from tab;
EOF
)
echo $count

Enjoy!
]]></description>
			<content:encoded><![CDATA[<p>Hi</p>
<p>Often it can be useful to return the result of a simple SQL*Plus query to a shell script variable, for example to check for a value before deciding wether or not to proceed.  The syntax is actually pretty simple :</p>
<pre>#!/bin/sh</pre>
<pre>count=$(sqlplus -s 'scott/tiger@xe'&lt;&lt;EOF</pre>
<pre>  set pages 0 feed off</pre>
<pre>  select count(*) from tab;
EOF
)
echo $count

<span style="font-family: 'Lucida Grande'; line-height: 19px; white-space: normal; font-size: 13px;">Enjoy!</span></pre>
]]></content:encoded>
			<wfw:commentRss>http://www.mercatorgeosystems.com/blog/?feed=rss2&amp;p=34</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>Updating Oracle tables using a &#8216;join&#8217;</title>
		<link>http://www.mercatorgeosystems.com/blog/?p=33</link>
		<comments>http://www.mercatorgeosystems.com/blog/?p=33#comments</comments>
		<pubDate>Fri, 09 Jan 2009 11:51:17 +0000</pubDate>
		<dc:creator>admin</dc:creator>
				<category><![CDATA[Oracle]]></category>
		<category><![CDATA[join]]></category>
		<category><![CDATA[merge]]></category>
		<category><![CDATA[nvl]]></category>
		<category><![CDATA[update]]></category>

		<guid isPermaLink="false">http://www.mercatorgeosystems.com/blog/?p=33</guid>
		<description><![CDATA[Doing a &#8216;join update&#8217; in Oracle can sometime cause a few headaches. By &#8216;join update&#8217; I mean the situation where we have two tables and want to update some of the rows in the first table based on values that exist in the second table.  
Imagine this scenario :
drop table t;
drop table s;
create table t (id [...]]]></description>
			<content:encoded><![CDATA[<p>Doing a &#8216;join update&#8217; in Oracle can sometime cause a few headaches. By &#8216;join update&#8217; I mean the situation where we have two tables and want to update <em>some </em>of the rows in the first table based on values that exist in the second table.  </p>
<p>Imagine this scenario :</p>
<pre>drop table t;</pre>
<pre>drop table s;</pre>
<pre>create table t (id number, name varchar2(32));</pre>
<pre>create table s (id number, name varchar2(32));</pre>
<p> </p>
<pre>insert into t values (1,'1');</pre>
<pre>insert into t values (2,'2');</pre>
<pre>insert into t values (3,'3');</pre>
<pre>insert into t values (4,'4');</pre>
<pre>insert into t values (5,'5');</pre>
<p> </p>
<pre>insert into s values (3,'three');</pre>
<pre>insert into s values (5,'five');</pre>
<pre>select * from t;</pre>
<pre>update t</pre>
<pre>   set name = (select name</pre>
<pre>                 from s</pre>
<pre>                where t.id = s.id);</pre>
<pre>select * from t;</pre>
<p>Our first table (t) simply has the numbers 1-5 in the &#8216;id&#8217; and &#8216;name&#8217; column but we want to update some of the names based on the contents of the second table (s) but this table only has values for two of the rows.  This is OK so long as we can preserve the &#8216;default&#8217; numeric values.  However the script above gives the following output :</p>
<pre>drop table t succeeded.

drop table s succeeded.

create table succeeded.

create table succeeded.

1 rows inserted

1 rows inserted

1 rows inserted

1 rows inserted

1 rows inserted

1 rows inserted

1 rows inserted

ID                     NAME                             
---------------------- -------------------------------- 
1                      1                                
2                      2                                
3                      3                                
4                      4                                
5                      5                                

5 rows selected

5 rows updated

ID                     NAME                             
---------------------- -------------------------------- 
1                                                       
2                                                       
3                      three                            
4                                                       
5                      five                             
 
5 rows selected</pre>
<p>The problem here is that the update isn&#8217;t a true &#8216;join&#8217; as every row is going to be updated and if the &#8216;join&#8217; fails then a null is written.  The traditional solution to this is to rewrite the SQL to be something like :</p>
<pre>update t</pre>
<pre>   set name = (select name</pre>
<pre>                 from s</pre>
<pre>                where t.id = s.id)</pre>
<pre> where exists (select 1</pre>
<pre>                 from s</pre>
<pre>                where t.id = s.id);</pre>
<pre>select * from t;</pre>
<p>which does the job correctly :</p>
<pre>2 rows updated</pre>
<pre>ID                     NAME </pre>
<pre>---------------------- -------------------------------- </pre>
<pre>1                      1 </pre>
<pre>2                      2 </pre>
<pre>3                      three </pre>
<pre>4                      4 </pre>
<pre>5                      five</pre>
<p> </p>
<pre>5 rows selected</pre>
<p>However this isn&#8217;t a very good solution for updates involving very large tables as it can significantly slow things down.  One alternative is the MERGE statement :</p>
<pre>merge into t
 using (select id, name
          from s) s
    on (t.id = s.id)
 when matched then
   update set t.name = s.name;

select * from t;</pre>
<pre>2 rows merged</pre>
<pre>ID                     NAME </pre>
<pre>---------------------- -------------------------------- </pre>
<pre>1                      1 </pre>
<pre>2                      2 </pre>
<pre>3                      three </pre>
<pre>4                      4 </pre>
<pre>5                      five</pre>
<pre>5 rows selected</pre>
<p>An other option is to use the NVL() function which allows you to deal with the problem of the nulls above :</p>
<pre>update t
   set name = nvl((select name
                    from s
                   where t.id = s.id), t.name);

select * from t;</pre>
<p>which also works :</p>
<p><span style="font-family: 'Courier New'; line-height: 18px; white-space: pre;">5 rows updated</span></p>
<pre>ID                     NAME </pre>
<pre>---------------------- -------------------------------- </pre>
<pre>1                      1 </pre>
<pre>2                      2 </pre>
<pre>3                      three </pre>
<pre>4                      4 </pre>
<pre>5                      five</pre>
<pre>5 rows selected</pre>
<p> </p>
]]></content:encoded>
			<wfw:commentRss>http://www.mercatorgeosystems.com/blog/?feed=rss2&amp;p=33</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
	</channel>
</rss>
