<?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>non-random ramble &#187; databases</title>
	<atom:link href="http://jimbarritt.com/non-random/category/code/databases/feed/" rel="self" type="application/rss+xml" />
	<link>http://jimbarritt.com/non-random</link>
	<description>adventures in code</description>
	<lastBuildDate>Tue, 20 Sep 2011 13:16:52 +0000</lastBuildDate>
	<language>en</language>
	<sy:updatePeriod>hourly</sy:updatePeriod>
	<sy:updateFrequency>1</sy:updateFrequency>
	<generator>http://wordpress.org/?v=3.3.1</generator>
		<item>
		<title>Oracle Jdbc Driver 10.2.0.2.0 fails to render Euro (€) when db is set to WE8MSWIN1252 encoding</title>
		<link>http://jimbarritt.com/non-random/2010/11/08/oracle-jdbc-driver-10-2-0-2-0-fails-to-render-euro-e-when-db-is-set-to-we8mswin1252-encoding/</link>
		<comments>http://jimbarritt.com/non-random/2010/11/08/oracle-jdbc-driver-10-2-0-2-0-fails-to-render-euro-e-when-db-is-set-to-we8mswin1252-encoding/#comments</comments>
		<pubDate>Mon, 08 Nov 2010 16:46:41 +0000</pubDate>
		<dc:creator>Jim Barritt</dc:creator>
				<category><![CDATA[databases]]></category>
		<category><![CDATA[hibernate]]></category>
		<category><![CDATA[java]]></category>
		<category><![CDATA[random]]></category>

		<guid isPermaLink="false">http://jimbarritt.com/non-random/?p=741</guid>
		<description><![CDATA[We just spent a few glorious hours or so trawling the internet and writing old skool jdbc code, to discover this little beauty. Simply upgrade to 10.2.0.5 of the jdbc driver and it goes away. Thanks to this post http://efreedom.com/Question/1-377745/Oracle-JDBC-Euro-Character we discovered our problem. For the full details on the euro&#8230;. http://www.fileformat.info/info/unicode/char/20ac/index.htm And if your [...]]]></description>
			<content:encoded><![CDATA[<p><a href="http://jimbarritt.com/non-random/wp-content/uploads/2010/11/euro_sign.png" rel="lightbox[741]"><img src="http://jimbarritt.com/non-random/wp-content/uploads/2010/11/euro_sign.png" alt="" title="euro_sign" width="100" height="100" class="aligncenter size-full wp-image-743" /></a></p>
<p>We just spent a few glorious hours or so trawling the internet and writing old skool jdbc code, to discover this little beauty. Simply upgrade to 10.2.0.5 of the jdbc driver and it goes away.</p>
<p>Thanks to this post http://efreedom.com/Question/1-377745/Oracle-JDBC-Euro-Character we discovered our problem.</p>
<p>For the full details on the euro&#8230;. </p>
<p>http://www.fileformat.info/info/unicode/char/20ac/index.htm</p>
<p>And if your really bored:</p>
<p>http://www.fileformat.info/info/unicode/char/1f47e/index.htm</p>
<p><a class="a2a_dd a2a_target addtoany_share_save" href="http://www.addtoany.com/share_save#url=http%3A%2F%2Fjimbarritt.com%2Fnon-random%2F2010%2F11%2F08%2Foracle-jdbc-driver-10-2-0-2-0-fails-to-render-euro-e-when-db-is-set-to-we8mswin1252-encoding%2F&amp;title=Oracle%20Jdbc%20Driver%2010.2.0.2.0%20fails%20to%20render%20Euro%20%28%E2%82%AC%29%20when%20db%20is%20set%20to%20WE8MSWIN1252%20encoding" id="wpa2a_2"><img src="http://jimbarritt.com/non-random/wp-content/plugins/add-to-any/share_save_256_24.png" width="256" height="24" alt="Share"/></a></p>]]></content:encoded>
			<wfw:commentRss>http://jimbarritt.com/non-random/2010/11/08/oracle-jdbc-driver-10-2-0-2-0-fails-to-render-euro-e-when-db-is-set-to-we8mswin1252-encoding/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>Install Oracle XE 10g On OS X with VMWare Fusion</title>
		<link>http://jimbarritt.com/non-random/2010/04/21/install-oracle-xe-10g-on-os-x-with-vmware-fusion/</link>
		<comments>http://jimbarritt.com/non-random/2010/04/21/install-oracle-xe-10g-on-os-x-with-vmware-fusion/#comments</comments>
		<pubDate>Wed, 21 Apr 2010 13:40:09 +0000</pubDate>
		<dc:creator>Jim Barritt</dc:creator>
				<category><![CDATA[code]]></category>
		<category><![CDATA[databases]]></category>
		<category><![CDATA[oracle]]></category>
		<category><![CDATA[sysadmin]]></category>

		<guid isPermaLink="false">http://jimbarritt.com/non-random/?p=392</guid>
		<description><![CDATA[Oracle don&#8217;t yet provide a native OS X installer for XE but you can install it on a virtual machine running under OS X. I found a very detailed article here [1] but also found it quite hard to follow, so thought I would post my own experience here, referring back to that one where [...]]]></description>
			<content:encoded><![CDATA[<p><img alt="Oracle HQ" src="http://www.tonie.net/images/sanjose2001/siliconvalley/oracle1.jpg" title="Oracle HQ" class="aligncenter" width="400"  /></p>
<p>Oracle don&#8217;t yet provide a native OS X installer for XE but you can install it on a virtual machine running under OS X.</p>
<p>I found a very detailed article here <a href="#REF-1">[1]</a> but also found it quite hard to follow, so thought I would post my own experience here, referring back to that one where appropriate.</p>
<p>First you need <a href="http://www.vmware.com/products/fusion/">VMWare Fusion</a></p>
<p>I have installed Windows XP SP 2 on there.</p>
<p>The installation of Fusion and XP was pretty straightforward, just point and click. Once the windows guest machine is set up, fusion should prompt you to install VMWare tools which makes the graphics look much better. It will also ask you to install McAffee anti virus (its a free 12 month trial) which I did. </p>
<p>According to <a href="#REF-1">[1]</a>, it is important to set the computer name. In my case I set this to be &#8220;winxp-guest&#8221; (right click My Computer).</p>
<p>Next thing is to get the networking set up correctly. You have 3 options with VMWare Fusion:</p>
<ul>
<li>NAT &#8211; share the network adapter with the host machine</li>
<li>BRIDGED &#8211; VM appears to be a seperate machine to the host</li>
<li>PRIVATE &#8211; VM is only available within the host machine and not on the wider network</li>
</ul>
<p>PRIVATE networking means your VM cannot connect to the internet, so the best option is <b>NAT</b></p>
<p>When you change your network settings you need to renew your network config:</p>
<pre name='code' class='java:nogutter:nocontrols'>
ipconfig /release
ipconfig /renew
</pre>
<p>You should see your IP address like this:</p>
<pre name='code' class='java:nogutter:nocontrols'>
C:\Documents and Settings\Administrator>ipconfig /renew
Windows IP Configuration
Ethernet adapter Local Area Connection:
       Connection-specific DNS Suffix  . : localdomain
       IP Address. . . . . . . . . . . . : 192.168.xx.xxx
       Subnet Mask . . . . . . . . . . . : 255.255.255.0
       Default Gateway . . . . . . . . . : 192.168.xx.xx
</pre>
<p>In order to be able to connect to your guest machine from outside, you need to configure firewalls&#8230;</p>
<p>Initially, I disabled McAffee. Once I got everything working, I re-enabled Mcaffee and found that when I tried to access using SqlDeveloper it automatically asked me if I wanted to allow this program.</p>
<p>To setup the windows firewall, you need to go to Control Panel -> Windows Firewall -> Exceptions -> Add Port&#8230;<br />
You&#8217;ll need to do this twice, one for http access to the admin tool (8080) and one for client access (1521 which is the default) </p>
<p>You also need to select Advanced -> ICMP -> Allow incoming echo request if you want to be able to ping it.</p>
<p>From the host:<br />
<pre name='code' class='java:nogutter:nocontrols'>
ping 192.168.xx.xxx
64 bytes from 192.168.xx.xxx: icmp_seq=0 ttl=128 time=0.290 ms
64 bytes from 192.168.xx.xxx: icmp_seq=1 ttl=128 time=0.498 ms
</pre></p>
<p>You should also setup your hosts file on the host computer:</p>
<pre name='code' class='java:nogutter:nocontrols'>
sudo vi /etc/hosts
##
# Host Database
#
# localhost is used to configure the loopback interface
# when the system is booting.  Do not change this entry.
##
127.0.0.1       localhost
255.255.255.255 broadcasthost
::1             localhost
fe80::1%lo0     localhost
192.168.xx.xxx winxp-guest winxp-guest.localdomain
</pre>
<p>The localdomain part I found out from installing apache. Note, I also ran &#8220;Network ID&#8221; wizard from the My Computer-> Computer Name screen, not sure if that made a difference.</p>
<p>Now you can <code>ping winxp-guest</code></p>
<p>To check that everything is in order, I installed <a href="http://www.apache.org/dist/httpd/binaries/win32/">apache</a> on the guest </p>
<p>I picked <code>httpd-2.2.15-win32-x86-no_ssl.msi</code> and within a few moments I can navigate to <code>http://winxp-guest</code>on the guest machine and see an apache &#8220;It Works!&#8221; page.</p>
<p>I can also do this from my host machine, so networking is all good.</p>
<p>In the reference it mentions setting up the windows hosts file aswell on the guest machine, this is so that everything works on the guest machine with the tnsnames.ora file (it get generated to point to whatever the hostname of your machine is). It is not important to connect from the host machine.</p>
<pre name='code' class='java:nogutter:nocontrols'>
# For example:
#
#      102.54.94.97     rhino.acme.com          # source server
#       38.25.63.10     x.acme.com              # x client host
127.0.0.1       localhost
192.168.xx.xxx winxp-guest winxp-guest.localdomain
</pre>
<p>Next install Oracle XE itself. The only thing required to enter here is a password, which you will later use to log in to the web interface with the user &#8220;SYSTEM&#8221;</p>
<p>Once installed, you can launch the home page and log in as SYSTEM. The first thing to do is to change &#8220;Administration->Http Access&#8221; which will allow computers outside the machine to access the admin console.</p>
<p>Then you can try it out using sqlplus. I found there was a mistake in the Environment PATH variable &#8211; it had referred to the bin directory as &#8220;bin&#8221; but in windows it was actually &#8220;BIN&#8221;. Changing it made it work for me.</p>
<pre name='code' class='java:nogutter:nocontrols'>
sqlplus SYSTEM/{password}@XE
SQL> create table foo (bar number, baz varchar(255));
SQL> insert into foo VALUES (2, &#8216;blah&#8217;);
SQL> select * from foo;
       BAR
&#8212;&#8212;&#8212;-
BAZ
&#8212;&#8212;&#8212;&#8212;&#8212;&#8211;
         2
blah
SQL> drop table foo;
</pre>
<p>Brilliant. You have an oracle database.</p>
<p>The connection XE is from your tnsnames.ora file which lives (in default install) at <code>C:\oraclexe\app\oracle\product\10.2.0\server\NETWORK\ADMIN</code></p>
<p>and contains:</p>
<pre name='code' class='java:nogutter:nocontrols'>
XE =
  (DESCRIPTION =
    (ADDRESS = (PROTOCOL = TCP)(HOST = winxp-guest)(PORT = 1521))
    (CONNECT_DATA =
      (SERVER = DEDICATED)
      (SERVICE_NAME = XE)
    )
  )
</pre>
<p>Notice the hostname in here. Presumably if you wanted to change this you could update this file and the computer name and your hosts file.</p>
<p>Next step is to try accessing from the host machine.</p>
<p>I used Oracle <a href="http://www.oracle.com/technology/software/products/sql/index.html">SQLDeveloper</a></p>
<p>I used a jdbc connection string of jdbc:oracle:thin:@winxp-guest:1521:xe</p>
<p>Note that as long as you update /etc/hosts on the host machine, you can call the computer whatever you like (e.g. oraclexe)</p>
<p>Something you might need to do is create a new tablespace. You can do this through the oracle administration console. Go to &#8220;home&#8221; and then SQL and you can execute sql like this:<br />
<pre name='code' class='java:nogutter:nocontrols'>
create tablespace
 datafile &#8216;/ORACLEXE/ORADATA/XE/{table_space_name}/{table_space_name}.dbf&#8217; size 500m;
</pre></p>
<p>References:</p>
<p><a name="REF-1">[1] http://blog.mclaughlinsoftware.com/how-to-configure-mac-os-x-as-an-oracle-client/</a></table_space_name>
<p><a class="a2a_dd a2a_target addtoany_share_save" href="http://www.addtoany.com/share_save#url=http%3A%2F%2Fjimbarritt.com%2Fnon-random%2F2010%2F04%2F21%2Finstall-oracle-xe-10g-on-os-x-with-vmware-fusion%2F&amp;title=Install%20Oracle%20XE%2010g%20On%20OS%20X%20with%20VMWare%20Fusion" id="wpa2a_4"><img src="http://jimbarritt.com/non-random/wp-content/plugins/add-to-any/share_save_256_24.png" width="256" height="24" alt="Share"/></a></p>]]></content:encoded>
			<wfw:commentRss>http://jimbarritt.com/non-random/2010/04/21/install-oracle-xe-10g-on-os-x-with-vmware-fusion/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>Format a SQL String nicely (and simply)</title>
		<link>http://jimbarritt.com/non-random/2008/10/02/format-a-sql-string-nicely-and-simply/</link>
		<comments>http://jimbarritt.com/non-random/2008/10/02/format-a-sql-string-nicely-and-simply/#comments</comments>
		<pubDate>Thu, 02 Oct 2008 16:17:04 +0000</pubDate>
		<dc:creator>Jim Barritt</dc:creator>
				<category><![CDATA[code]]></category>
		<category><![CDATA[databases]]></category>

		<guid isPermaLink="false">http://jimbarritt.com/non-random/2008/10/02/format-a-sql-string-nicely-and-simply/</guid>
		<description><![CDATA[After playing with regular expressions in notepad+, we were writing some tests around a SQL based query language and wanted to print out the queries nicely. We came up with the remarkably simply yet effective use of String.replace() to create the following: String querystring = getSomeQueryString(); System.out.println(queryString .replaceAll("WHERE", "\\nWHERE") .replaceAll("AND", "\\n\\tAND") .replaceAll("OR", "\\n\\t\\tOR")); Well it [...]]]></description>
			<content:encoded><![CDATA[<p>After playing with regular expressions in notepad+, we were writing some tests around a SQL based query language and wanted to print out the queries nicely.</p>
<p>We came up with the remarkably simply yet effective use of <code>String.replace()</code> to create the following:</p>
<pre>
<code>
     String querystring = getSomeQueryString();
     System.out.println(queryString
                .replaceAll("WHERE", "\\nWHERE")
                .replaceAll("AND", "\\n\\tAND")
                .replaceAll("OR", "\\n\\t\\tOR"));
</code>
</pre>
<p>Well it worked for ours, think might need some adjustment for different OR / AND structures.</p>
<p><a class="a2a_dd a2a_target addtoany_share_save" href="http://www.addtoany.com/share_save#url=http%3A%2F%2Fjimbarritt.com%2Fnon-random%2F2008%2F10%2F02%2Fformat-a-sql-string-nicely-and-simply%2F&amp;title=Format%20a%20SQL%20String%20nicely%20%28and%20simply%29" id="wpa2a_6"><img src="http://jimbarritt.com/non-random/wp-content/plugins/add-to-any/share_save_256_24.png" width="256" height="24" alt="Share"/></a></p>]]></content:encoded>
			<wfw:commentRss>http://jimbarritt.com/non-random/2008/10/02/format-a-sql-string-nicely-and-simply/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>Hibernate SQL logging</title>
		<link>http://jimbarritt.com/non-random/2008/09/29/hibernate-sql-logging/</link>
		<comments>http://jimbarritt.com/non-random/2008/09/29/hibernate-sql-logging/#comments</comments>
		<pubDate>Mon, 29 Sep 2008 14:10:42 +0000</pubDate>
		<dc:creator>Jim Barritt</dc:creator>
				<category><![CDATA[code]]></category>
		<category><![CDATA[databases]]></category>
		<category><![CDATA[sql]]></category>

		<guid isPermaLink="false">http://jimbarritt.com/non-random/2008/09/29/hibernate-sql-logging/</guid>
		<description><![CDATA[Just so i dont forget: log4j.category.org.hibernate.SQL=DEBUG log4j.category.org.hibernate.type=TRACE]]></description>
			<content:encoded><![CDATA[<p>Just so i dont forget:</p>
<p><code>log4j.category.org.hibernate.SQL=DEBUG</code></p>
<p><code>log4j.category.org.hibernate.type=TRACE</code></p>
<p><a class="a2a_dd a2a_target addtoany_share_save" href="http://www.addtoany.com/share_save#url=http%3A%2F%2Fjimbarritt.com%2Fnon-random%2F2008%2F09%2F29%2Fhibernate-sql-logging%2F&amp;title=Hibernate%20SQL%20logging" id="wpa2a_8"><img src="http://jimbarritt.com/non-random/wp-content/plugins/add-to-any/share_save_256_24.png" width="256" height="24" alt="Share"/></a></p>]]></content:encoded>
			<wfw:commentRss>http://jimbarritt.com/non-random/2008/09/29/hibernate-sql-logging/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>Shards&#8230;</title>
		<link>http://jimbarritt.com/non-random/2008/04/16/shards/</link>
		<comments>http://jimbarritt.com/non-random/2008/04/16/shards/#comments</comments>
		<pubDate>Wed, 16 Apr 2008 13:34:09 +0000</pubDate>
		<dc:creator>Jim Barritt</dc:creator>
				<category><![CDATA[databases]]></category>

		<guid isPermaLink="false">http://jimbarritt.com/non-random/2008/04/16/shards/</guid>
		<description><![CDATA[Found this cool blog about shards&#8230; i.e. scale by putting each users data on a cheap db box &#8211; multiple parallel writes possible. http://mysqldba.blogspot.com/2006/10/unorthodox-approach-to-database-design.html]]></description>
			<content:encoded><![CDATA[<p>Found this cool blog about shards&#8230;</p>
<p>i.e. scale by putting each users data on a cheap db box &#8211; multiple parallel writes possible.</p>
<p><a href='http://mysqldba.blogspot.com/2006/10/unorthodox-approach-to-database-design.html'>http://mysqldba.blogspot.com/2006/10/unorthodox-approach-to-database-design.html</a></p>
<p><a class="a2a_dd a2a_target addtoany_share_save" href="http://www.addtoany.com/share_save#url=http%3A%2F%2Fjimbarritt.com%2Fnon-random%2F2008%2F04%2F16%2Fshards%2F&amp;title=Shards%E2%80%A6" id="wpa2a_10"><img src="http://jimbarritt.com/non-random/wp-content/plugins/add-to-any/share_save_256_24.png" width="256" height="24" alt="Share"/></a></p>]]></content:encoded>
			<wfw:commentRss>http://jimbarritt.com/non-random/2008/04/16/shards/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>Limit number of rows in an oracle query</title>
		<link>http://jimbarritt.com/non-random/2006/03/29/limit-number-of-rows-in-an-oracle-query/</link>
		<comments>http://jimbarritt.com/non-random/2006/03/29/limit-number-of-rows-in-an-oracle-query/#comments</comments>
		<pubDate>Wed, 29 Mar 2006 02:13:58 +0000</pubDate>
		<dc:creator>Jim Barritt</dc:creator>
				<category><![CDATA[databases]]></category>
		<category><![CDATA[oracle]]></category>
		<category><![CDATA[sql]]></category>

		<guid isPermaLink="false">http://www.planet-ix.com/non-random/2006/03/29/limit-number-of-rows-in-an-oracle-query/</guid>
		<description><![CDATA[select * from ( select * from (select * from CODETABLE_READCODE) order by DESCRIPTION ) where rownum]]></description>
			<content:encoded><![CDATA[<p>select *<br />
from (<br />
select *<br />
from (select * from CODETABLE_READCODE)<br />
order by DESCRIPTION<br />
)<br />
where rownum <= 6</p>
<p><a class="a2a_dd a2a_target addtoany_share_save" href="http://www.addtoany.com/share_save#url=http%3A%2F%2Fjimbarritt.com%2Fnon-random%2F2006%2F03%2F29%2Flimit-number-of-rows-in-an-oracle-query%2F&amp;title=Limit%20number%20of%20rows%20in%20an%20oracle%20query" id="wpa2a_12"><img src="http://jimbarritt.com/non-random/wp-content/plugins/add-to-any/share_save_256_24.png" width="256" height="24" alt="Share"/></a></p>]]></content:encoded>
			<wfw:commentRss>http://jimbarritt.com/non-random/2006/03/29/limit-number-of-rows-in-an-oracle-query/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>Websphere Wierdness</title>
		<link>http://jimbarritt.com/non-random/2006/03/14/websphere-wierdness/</link>
		<comments>http://jimbarritt.com/non-random/2006/03/14/websphere-wierdness/#comments</comments>
		<pubDate>Tue, 14 Mar 2006 02:26:53 +0000</pubDate>
		<dc:creator>Jim Barritt</dc:creator>
				<category><![CDATA[databases]]></category>
		<category><![CDATA[oracle]]></category>
		<category><![CDATA[sql]]></category>
		<category><![CDATA[websphere]]></category>

		<guid isPermaLink="false">http://www.planet-ix.com/non-random/2006/03/14/websphere-wierdness/</guid>
		<description><![CDATA[I discovered a joyful thing with the websphere JDBC connection: You want to make a prepared statement that uses the &#8220;like&#8221; operator. You write : select * from SOMETABLE where SOMECOLUMN like ? and it throws an IndexOutOfBoundsException !! YOU HAVE TO GET THE CASE CORRECT! so : select * from SOMETABLE where SOMECOLUMN LIKE [...]]]></description>
			<content:encoded><![CDATA[<p>I discovered a joyful thing with the websphere JDBC connection:</p>
<p>You want to make a prepared statement that uses the &#8220;like&#8221; operator.</p>
<p>You write :</p>
<p>select * from SOMETABLE where SOMECOLUMN like ?</p>
<p>and it throws an IndexOutOfBoundsException !!</p>
<p>YOU HAVE TO GET THE CASE CORRECT! so :</p>
<p>select * from SOMETABLE where SOMECOLUMN LIKE ?</p>
<p>or</p>
<p>select * from SOMETABLE where SOMECOLUMN Like ?</p>
<p>Weird eh ?</p>
<p>also if you want to select by a date you have to do :</p>
<p>select * from SOMETABLE where SOMEDATECOLUMN = to_date(?, &#8216;dd-mm-yyyy&#8217;)</p>
<p>putting in whatever format you have.</p>
<p><a class="a2a_dd a2a_target addtoany_share_save" href="http://www.addtoany.com/share_save#url=http%3A%2F%2Fjimbarritt.com%2Fnon-random%2F2006%2F03%2F14%2Fwebsphere-wierdness%2F&amp;title=Websphere%20Wierdness" id="wpa2a_14"><img src="http://jimbarritt.com/non-random/wp-content/plugins/add-to-any/share_save_256_24.png" width="256" height="24" alt="Share"/></a></p>]]></content:encoded>
			<wfw:commentRss>http://jimbarritt.com/non-random/2006/03/14/websphere-wierdness/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>Cool Oracle Doc</title>
		<link>http://jimbarritt.com/non-random/2006/01/25/cool-oracle-doc/</link>
		<comments>http://jimbarritt.com/non-random/2006/01/25/cool-oracle-doc/#comments</comments>
		<pubDate>Tue, 24 Jan 2006 21:08:17 +0000</pubDate>
		<dc:creator>Jim Barritt</dc:creator>
				<category><![CDATA[databases]]></category>
		<category><![CDATA[oracle]]></category>

		<guid isPermaLink="false">http://www.planet-ix.com/non-random/2006/01/25/cool-oracle-doc/</guid>
		<description><![CDATA[http://www.oracle.com/technology/tech/xml/xmldb/Current/TWP_Mastering_XMLDB_Queries.pdf]]></description>
			<content:encoded><![CDATA[<p>http://www.oracle.com/technology/tech/xml/xmldb/Current/TWP_Mastering_XMLDB_Queries.pdf</p>
<p><a class="a2a_dd a2a_target addtoany_share_save" href="http://www.addtoany.com/share_save#url=http%3A%2F%2Fjimbarritt.com%2Fnon-random%2F2006%2F01%2F25%2Fcool-oracle-doc%2F&amp;title=Cool%20Oracle%20Doc" id="wpa2a_16"><img src="http://jimbarritt.com/non-random/wp-content/plugins/add-to-any/share_save_256_24.png" width="256" height="24" alt="Share"/></a></p>]]></content:encoded>
			<wfw:commentRss>http://jimbarritt.com/non-random/2006/01/25/cool-oracle-doc/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>Oracle forum</title>
		<link>http://jimbarritt.com/non-random/2006/01/25/oracle-forum/</link>
		<comments>http://jimbarritt.com/non-random/2006/01/25/oracle-forum/#comments</comments>
		<pubDate>Tue, 24 Jan 2006 20:40:14 +0000</pubDate>
		<dc:creator>Jim Barritt</dc:creator>
				<category><![CDATA[databases]]></category>
		<category><![CDATA[oracle]]></category>
		<category><![CDATA[sql]]></category>

		<guid isPermaLink="false">http://www.planet-ix.com/non-random/2006/01/25/oracle-forum/</guid>
		<description><![CDATA[http://forums.oracle.com/forums/forum.jspa?forumID=34]]></description>
			<content:encoded><![CDATA[<p>http://forums.oracle.com/forums/forum.jspa?forumID=34</p>
<p><a class="a2a_dd a2a_target addtoany_share_save" href="http://www.addtoany.com/share_save#url=http%3A%2F%2Fjimbarritt.com%2Fnon-random%2F2006%2F01%2F25%2Foracle-forum%2F&amp;title=Oracle%20forum" id="wpa2a_18"><img src="http://jimbarritt.com/non-random/wp-content/plugins/add-to-any/share_save_256_24.png" width="256" height="24" alt="Share"/></a></p>]]></content:encoded>
			<wfw:commentRss>http://jimbarritt.com/non-random/2006/01/25/oracle-forum/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>Filtering a view which is based on an xml CLOB</title>
		<link>http://jimbarritt.com/non-random/2006/01/24/filtering-a-view-which-is-based-on-an-xml-clob/</link>
		<comments>http://jimbarritt.com/non-random/2006/01/24/filtering-a-view-which-is-based-on-an-xml-clob/#comments</comments>
		<pubDate>Tue, 24 Jan 2006 04:36:02 +0000</pubDate>
		<dc:creator>Jim Barritt</dc:creator>
				<category><![CDATA[databases]]></category>
		<category><![CDATA[oracle]]></category>
		<category><![CDATA[sql]]></category>
		<category><![CDATA[xml]]></category>

		<guid isPermaLink="false">http://www.planet-ix.com/non-random/2006/01/24/filtering-a-view-which-is-based-on-an-xml-clob/</guid>
		<description><![CDATA[Ok, so you create a table which has an xml blob. THen you create a view onto that table which maps elements inside the XML blob to columns in the view, thus &#8220;expanding&#8221; out the xml to look like a normal table. To do this you use the extract() method in oracle (see other posts) [...]]]></description>
			<content:encoded><![CDATA[<p>Ok, so you create a table which has an xml blob.</p>
<p>THen you create a view onto that table which maps elements inside the XML blob to columns in the view, thus &#8220;expanding&#8221; out the xml to look like a normal table.</p>
<p>To do this you use the extract() method in oracle (see other posts) .</p>
<p>Now you want to filter the view based on nodes which are inside the xml data but oracle wont let you do it directly because the columns arent real columns.</p>
<p>SO</p>
<p>You need to include a unique key in the view &#8211; then you can do the select on the original table and JOIN the view to it! bit convoluted but it works! as long as there is a unique key of course &#8211; so you might have to design your xml table with this in mind but even if this is arbitrary it will still work.</p>
<p>here is an example :</p>
<p>SELECT tbview.* FROM TABLE_ONE tb, TABLE_ONE_VIEW tbview<br />
WHERE<br />
tbview.UNIQUE_ID=tb.UNIQUE_ID<br />
AND<br />
tb.XML_COLUMN.existsNode(&#8216;/some/expath[with_test_node="TEST_2"]&#8216;)=1;</p>
<p>Sweet!</p>
<p><a class="a2a_dd a2a_target addtoany_share_save" href="http://www.addtoany.com/share_save#url=http%3A%2F%2Fjimbarritt.com%2Fnon-random%2F2006%2F01%2F24%2Ffiltering-a-view-which-is-based-on-an-xml-clob%2F&amp;title=Filtering%20a%20view%20which%20is%20based%20on%20an%20xml%20CLOB" id="wpa2a_20"><img src="http://jimbarritt.com/non-random/wp-content/plugins/add-to-any/share_save_256_24.png" width="256" height="24" alt="Share"/></a></p>]]></content:encoded>
			<wfw:commentRss>http://jimbarritt.com/non-random/2006/01/24/filtering-a-view-which-is-based-on-an-xml-clob/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
	</channel>
</rss>

