<?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; sql</title>
	<atom:link href="http://jimbarritt.com/non-random/category/code/sql/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>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_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/2008/09/29/hibernate-sql-logging/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_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/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_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/2006/03/14/websphere-wierdness/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_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/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_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/2006/01/24/filtering-a-view-which-is-based-on-an-xml-clob/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>SQL Query Using XPATH</title>
		<link>http://jimbarritt.com/non-random/2006/01/24/sql-query-using-xpath/</link>
		<comments>http://jimbarritt.com/non-random/2006/01/24/sql-query-using-xpath/#comments</comments>
		<pubDate>Tue, 24 Jan 2006 04:02:15 +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/sql-query-using-xpath/</guid>
		<description><![CDATA[eg : WHERE tb.XML_COLUMN.existsNode(&#8216;/some/xpath[with_test="Jeff"]&#8216;)=1 have to use this &#8220;existsNode&#8221; the xpath can then do the filter &#8211; if you want to filter on the value of a node you do the above, otherwise use @ for attributes.]]></description>
			<content:encoded><![CDATA[<p>eg :</p>
<p>WHERE tb.XML_COLUMN.existsNode(&#8216;/some/xpath[with_test="Jeff"]&#8216;)=1</p>
<p>have to use this &#8220;existsNode&#8221; the xpath can then do the filter &#8211; if you want to filter on the value of a node you do the above, otherwise use @ for attributes.</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%2Fsql-query-using-xpath%2F&amp;title=SQL%20Query%20Using%20XPATH" 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/01/24/sql-query-using-xpath/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>Oracle and simple SQL</title>
		<link>http://jimbarritt.com/non-random/2006/01/18/oracle-and-simple-sql/</link>
		<comments>http://jimbarritt.com/non-random/2006/01/18/oracle-and-simple-sql/#comments</comments>
		<pubDate>Tue, 17 Jan 2006 23:37:39 +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/18/oracle-and-simple-sql/</guid>
		<description><![CDATA[So im playing with oracle and have forgotten everything i know about it. W3C shool for SQL! SELECT table_name FROM all_tables WHERE owner = USER; this gives me all my tables. cant even remember the syntax for a CREATE table!! create table test (column1 varchar(20), column2 int); insert into test values (&#8216;jim001&#8242;, 34); delete from [...]]]></description>
			<content:encoded><![CDATA[<p>So im playing with oracle and have forgotten everything i know about it.</p>
<p><a href="http://www.w3schools.com/default.asp">W3C shool for SQL!</a></p>
<p><span class="MsgBodyText"> SELECT table_name FROM all_tables WHERE owner = USER;</span></p>
<p><span class="MsgBodyText">this gives me all my tables.</span></p>
<p><span class="MsgBodyText">cant even remember the syntax for a CREATE table!!</span></p>
<p>create table test (column1 varchar(20), column2 int);</p>
<p>insert into test values (&#8216;jim001&#8242;, 34);</p>
<p>delete from test where column1=&#8217;jim001&#8242;;</p>
<p>update test set column1=&#8217;jim003&#8242;, column2=&#8217;56&#8242; where column1=&#8217;jim001&#8242;;</p>
<p>this will go in my wikki when i work out how to work that!:)</p>
<p>woohoo!! toad is so beautiful! i think its had a revamp&#8230;</p>
<p><a href="http://www.toadsoft.com/faq2.html">http://www.toadsoft.com/lic_agree.html</a></p>
<p><a href="http://www.toadsoft.com/faq2.html" /><a href="http://www.toadsoft.com/faq2.html"><br />
</a> <a href="http://www.toadsoft.com/faq2.html">an faq</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%2F2006%2F01%2F18%2Foracle-and-simple-sql%2F&amp;title=Oracle%20and%20simple%20SQL" 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/01/18/oracle-and-simple-sql/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
	</channel>
</rss>

