<?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>amnuts &#187; Databases</title>
	<atom:link href="http://blog.amnuts.com/category/databases/feed/" rel="self" type="application/rss+xml" />
	<link>http://blog.amnuts.com</link>
	<description>php projects, javascript, and... stuff.</description>
	<lastBuildDate>Fri, 07 May 2010 09:11:14 +0000</lastBuildDate>
	<generator>http://wordpress.org/?v=2.9.2</generator>
	<language>en</language>
	<sy:updatePeriod>hourly</sy:updatePeriod>
	<sy:updateFrequency>1</sy:updateFrequency>
			<item>
		<title>Pointless error message</title>
		<link>http://blog.amnuts.com/2009/12/21/pointless-error-message/</link>
		<comments>http://blog.amnuts.com/2009/12/21/pointless-error-message/#comments</comments>
		<pubDate>Mon, 21 Dec 2009 15:11:42 +0000</pubDate>
		<dc:creator>Andy</dc:creator>
				<category><![CDATA[Databases]]></category>
		<category><![CDATA[error]]></category>
		<category><![CDATA[oracle]]></category>

		<guid isPermaLink="false">http://blog.amnuts.com/?p=143</guid>
		<description><![CDATA[Just ran a bit of SQL on Oracle and this was the oh-so helpful error message I got back:
Warning:  ociexecute() [function.ociexecute]: OCIStmtExecute: ORA-00932: inconsistent datatypes: expected BINARY got BINARY
So you&#8217;re expecting a binary value and what you got was a binary value, but that&#8217;s inconsistent with the binary value you were expecting to be [...]]]></description>
			<content:encoded><![CDATA[<p>Just ran a bit of SQL on Oracle and this was the oh-so helpful error message I got back:</p>
<blockquote><p><strong>Warning</strong>:  ociexecute() [function.ociexecute]: OCIStmtExecute: ORA-00932: inconsistent datatypes: expected BINARY got BINARY</p></blockquote>
<p>So you&#8217;re expecting a binary value and what you got was a binary value, but that&#8217;s inconsistent with the binary value you were expecting to be binary?!</p>
]]></content:encoded>
			<wfw:commentRss>http://blog.amnuts.com/2009/12/21/pointless-error-message/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>Oracle extension oddity</title>
		<link>http://blog.amnuts.com/2007/08/22/oracle-extension-oddity/</link>
		<comments>http://blog.amnuts.com/2007/08/22/oracle-extension-oddity/#comments</comments>
		<pubDate>Wed, 22 Aug 2007 09:11:13 +0000</pubDate>
		<dc:creator>Andy</dc:creator>
				<category><![CDATA[Databases]]></category>
		<category><![CDATA[PHP]]></category>

		<guid isPermaLink="false">http://blog.amnuts.com/2007/08/22/oracle-extension-oddity/</guid>
		<description><![CDATA[Today I was working on some sql for Oracle and connecting to the database with the PHP4 OCI extension.  I&#8217;ve done this many times before, but today ran in to a little oddity that I thought was worth mentioning (mainly so I don&#8217;t forget and fall in to the trap again!)&#8230;

More often than not [...]]]></description>
			<content:encoded><![CDATA[<p>Today I was working on some sql for Oracle and connecting to the database with the PHP4 OCI extension.  I&#8217;ve done this many times before, but today ran in to a little oddity that I thought was worth mentioning (mainly so I don&#8217;t forget and fall in to the trap again!)&#8230;</p>
<p><span id="more-49"></span><br />
More often than not I&#8217;m pulling back fields and using their default name or in addition to the &#8216;as&#8217; keyword to rename it, such as:</p>
<pre class="brush: sql;">select
    t1.name
    t2.email_address as email
from
   name_table t1,
   email_table t2
where
   t1.id = t2.user_id(+)</pre>
<p>And when the dataset is pulled back with <strong>OCIFetchStatement</strong> the field names are always in uppercase.  I personally prefer lowercase so often use the array_change_key_case() function, but in this instance I wasn&#8217;t and just accessing the fields in uppercase, such as <strong>$results['EMAIL']</strong>.</p>
<p>Then I changed my sql to have a case statement which looked something like:</p>
<pre class="brush: sql;">case
    when
        t2.email_address like '%domain.com'
        or t2.email_address like '%anotherdomain.co.uk'
        or t2.email_address like '%similardomain.net'
    then
        t2.email_address
    else
        ''
end &quot;email&quot;</pre>
<p>And suddenly the email addresses weren&#8217;t showing on the site.  I ran the sql, and it was bringing back the email, but for some reason they just weren&#8217;t displaying when they should.</p>
<p>Turns out that using the double-quote around email_address was forcing the Oracle extension to return the field name in exactly the same way I had requested it &#8211; all lower case.  I changed that to &#8220;EMAIL&#8221; and all was right with the world again.</p>
<p>Something for me to bear in mind for the future.</p>
]]></content:encoded>
			<wfw:commentRss>http://blog.amnuts.com/2007/08/22/oracle-extension-oddity/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
	</channel>
</rss>
