<?xml version="1.0" encoding="UTF-8"?><rss version="2.0"
	xmlns:content="http://purl.org/rss/1.0/modules/content/"
	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:media="http://search.yahoo.com/mrss/"
		>
<channel>
	<title>Comments on: Cool Undocumented SQL Function SYS_OP_MAP_NONNULL and Some Alternatives</title>
	<atom:link href="http://awads.net/wp/2006/09/19/cool-undocumented-sql-function-sys_op_map_nonnull-and-some-alternatives/feed/" rel="self" type="application/rss+xml" />
	<link>http://awads.net/wp/2006/09/19/cool-undocumented-sql-function-sys_op_map_nonnull-and-some-alternatives/</link>
	<description>News, views, tips and tricks on Oracle and other fun stuff</description>
	<lastBuildDate>Tue, 24 Jan 2012 20:49:08 +0000</lastBuildDate>
	<sy:updatePeriod>hourly</sy:updatePeriod>
	<sy:updateFrequency>1</sy:updateFrequency>
	<generator>http://wordpress.org/?v=3.3.1</generator>
	<item>
		<title>By: Laurent Schneider</title>
		<link>http://awads.net/wp/2006/09/19/cool-undocumented-sql-function-sys_op_map_nonnull-and-some-alternatives/comment-page-1/#comment-51826</link>
		<dc:creator>Laurent Schneider</dc:creator>
		<pubDate>Thu, 06 Dec 2007 16:26:57 +0000</pubDate>
		<guid isPermaLink="false">http://awads.net/wp/2006/09/19/cool-undocumented-sql-function-sys_op_map_nonnull-and-some-alternatives/#comment-51826</guid>
		<description>&lt;p&gt;I tried&lt;/p&gt;

&lt;pre&gt;
select * from dual where sys_op_map_nonnull(null) = &#039;FF&#039; ;
D
-
X
&lt;/pre&gt;

&lt;p&gt;It does return a row on my 10.2.0.3&lt;/p&gt;
</description>
		<content:encoded><![CDATA[<p>I tried</p>

<pre>
select * from dual where sys_op_map_nonnull(null) = 'FF' ;
D
-
X
</pre>

<p>It does return a row on my 10.2.0.3</p>]]></content:encoded>
	</item>
	<item>
		<title>By: Michael Friedman</title>
		<link>http://awads.net/wp/2006/09/19/cool-undocumented-sql-function-sys_op_map_nonnull-and-some-alternatives/comment-page-1/#comment-50018</link>
		<dc:creator>Michael Friedman</dc:creator>
		<pubDate>Tue, 26 Sep 2006 01:18:47 +0000</pubDate>
		<guid isPermaLink="false">http://awads.net/wp/2006/09/19/cool-undocumented-sql-function-sys_op_map_nonnull-and-some-alternatives/#comment-50018</guid>
		<description>&lt;p&gt;Whoa.&lt;/p&gt;

&lt;p&gt;Am I confused?&lt;/p&gt;

&lt;p&gt;I thought sys_op_map_nonnull(&#039;any non-null value&#039;) was supposed be &#039;any non-null value&#039;.&lt;/p&gt;

&lt;p&gt;I can also guarantee to you that&lt;/p&gt;

&lt;pre&gt;select *
from dual
where sys_op_map_nonnull(null) = &#039;FF&#039;&lt;/pre&gt;

&lt;p&gt;returns a row.&lt;/p&gt;

&lt;p&gt;Now I think it&#039;s doing something more subtle - it&#039;s doing a mapping of anything you put in it so&lt;/p&gt;

&lt;pre&gt;select *
from dual
where sys_op_map_nonnull(null) = sys_op_map_nonnull(&#039;FF&#039;)&lt;/pre&gt;

&lt;p&gt;will not return a row... need to test.&lt;/p&gt;
</description>
		<content:encoded><![CDATA[<p>Whoa.</p>

<p>Am I confused?</p>

<p>I thought sys_op_map_nonnull(&#8216;any non-null value&#8217;) was supposed be &#8216;any non-null value&#8217;.</p>

<p>I can also guarantee to you that</p>

<pre>select *
from dual
where sys_op_map_nonnull(null) = 'FF'</pre>

<p>returns a row.</p>

<p>Now I think it&#8217;s doing something more subtle &#8211; it&#8217;s doing a mapping of anything you put in it so</p>

<pre>select *
from dual
where sys_op_map_nonnull(null) = sys_op_map_nonnull('FF')</pre>

<p>will not return a row&#8230; need to test.</p>]]></content:encoded>
	</item>
	<item>
		<title>By: Eddie Awad</title>
		<link>http://awads.net/wp/2006/09/19/cool-undocumented-sql-function-sys_op_map_nonnull-and-some-alternatives/comment-page-1/#comment-50017</link>
		<dc:creator>Eddie Awad</dc:creator>
		<pubDate>Tue, 26 Sep 2006 00:16:05 +0000</pubDate>
		<guid isPermaLink="false">http://awads.net/wp/2006/09/19/cool-undocumented-sql-function-sys_op_map_nonnull-and-some-alternatives/#comment-50017</guid>
		<description>&lt;p&gt;Jonathan, thanks for clarifying the subtlety of sys_op_map_nonnull.&lt;/p&gt;

&lt;p&gt;Here is a quick test that I think demonstrates Michael&#039;s point that sys_op_map_nonnull (col1) is the same as nvl(col1,&#039;FF&#039;):&lt;/p&gt;

&lt;pre&gt;&lt;code&gt;  EDDIE@XE&gt; CREATE TABLE t (
    2   col1  VARCHAR2(10),
    3   col2  VARCHAR2(10));

  Table created.

  EDDIE@XE&gt; INSERT INTO t
    2       VALUES (NULL,
    3               NULL
    4              )
    5  /

  1 row created.

  EDDIE@XE&gt; INSERT INTO t
    2       VALUES (&#039;FF&#039;,
    3               &#039;FF&#039;
    4              )
    5  /

  1 row created.

  EDDIE@XE&gt; INSERT INTO t
    2       VALUES (&#039;Eddie&#039;,
    3               &#039;Awad&#039;
    4              )
    5  /

  1 row created.

  EDDIE@XE&gt; SELECT NVL (col1, &#039;I am null&#039;) col1,
    2         NVL (col2, &#039;I am null&#039;) col2
    3    FROM t
    4   WHERE nvl(col1,&#039;FF&#039;) = nvl(col2,&#039;FF&#039;)
    5  /

  COL1       COL2
  ---------- ----------
  I am null  I am null
  FF         FF

  EDDIE@XE&gt; SELECT NVL (col1, &#039;I am null&#039;) col1,
    2         NVL (col2, &#039;I am null&#039;) col2
    3    FROM t
    4   WHERE sys_op_map_nonnull (col1) = sys_op_map_nonnull (col2)
    5  /

  COL1       COL2
  ---------- ----------
  I am null  I am null
  FF         FF
&lt;/code&gt;&lt;/pre&gt;

&lt;p&gt;So, if sys_op_map_nonnull (col1) did not act like nvl(col2,&#039;FF&#039;), Oracle would not return the row with the varchar2 value FF in both col1 and col2.&lt;/p&gt;

&lt;p&gt;I think the explanation here is that sys_op_map_nonnull (&#039;FF&#039;) equals sys_op_map_nonnull (&#039;FF&#039;) but sys_op_map_nonnull (&#039;FF&#039;) does not equal &#039;FF&#039;:&lt;/p&gt;

&lt;pre&gt;&lt;code&gt;  EDDIE@XE&gt; SELECT *
    2  FROM dual
    3  where  sys_op_map_nonnull (&#039;FF&#039;) = sys_op_map_nonnull (&#039;FF&#039;)
    4  /

  D
  -
  X

  EDDIE@XE&gt; SELECT *
    2  FROM dual
    3  where  sys_op_map_nonnull (&#039;FF&#039;) = &#039;FF&#039;
    4  /

  no rows selected
&lt;/code&gt;&lt;/pre&gt;
</description>
		<content:encoded><![CDATA[<p>Jonathan, thanks for clarifying the subtlety of sys_op_map_nonnull.</p>

<p>Here is a quick test that I think demonstrates Michael&#8217;s point that sys_op_map_nonnull (col1) is the same as nvl(col1,&#8217;FF&#8217;):</p>

<pre><code>  EDDIE@XE&gt; CREATE TABLE t (
    2   col1  VARCHAR2(10),
    3   col2  VARCHAR2(10));

  Table created.

  EDDIE@XE&gt; INSERT INTO t
    2       VALUES (NULL,
    3               NULL
    4              )
    5  /

  1 row created.

  EDDIE@XE&gt; INSERT INTO t
    2       VALUES ('FF',
    3               'FF'
    4              )
    5  /

  1 row created.

  EDDIE@XE&gt; INSERT INTO t
    2       VALUES ('Eddie',
    3               'Awad'
    4              )
    5  /

  1 row created.

  EDDIE@XE&gt; SELECT NVL (col1, 'I am null') col1,
    2         NVL (col2, 'I am null') col2
    3    FROM t
    4   WHERE nvl(col1,'FF') = nvl(col2,'FF')
    5  /

  COL1       COL2
  ---------- ----------
  I am null  I am null
  FF         FF

  EDDIE@XE&gt; SELECT NVL (col1, 'I am null') col1,
    2         NVL (col2, 'I am null') col2
    3    FROM t
    4   WHERE sys_op_map_nonnull (col1) = sys_op_map_nonnull (col2)
    5  /

  COL1       COL2
  ---------- ----------
  I am null  I am null
  FF         FF
</code></pre>

<p>So, if sys_op_map_nonnull (col1) did not act like nvl(col2,&#8217;FF&#8217;), Oracle would not return the row with the varchar2 value FF in both col1 and col2.</p>

<p>I think the explanation here is that sys_op_map_nonnull (&#8216;FF&#8217;) equals sys_op_map_nonnull (&#8216;FF&#8217;) but sys_op_map_nonnull (&#8216;FF&#8217;) does not equal &#8216;FF&#8217;:</p>

<pre><code>  EDDIE@XE&gt; SELECT *
    2  FROM dual
    3  where  sys_op_map_nonnull ('FF') = sys_op_map_nonnull ('FF')
    4  /

  D
  -
  X

  EDDIE@XE&gt; SELECT *
    2  FROM dual
    3  where  sys_op_map_nonnull ('FF') = 'FF'
    4  /

  no rows selected
</code></pre>]]></content:encoded>
	</item>
	<item>
		<title>By: Jonathan Lewis</title>
		<link>http://awads.net/wp/2006/09/19/cool-undocumented-sql-function-sys_op_map_nonnull-and-some-alternatives/comment-page-1/#comment-50016</link>
		<dc:creator>Jonathan Lewis</dc:creator>
		<pubDate>Mon, 25 Sep 2006 21:48:18 +0000</pubDate>
		<guid isPermaLink="false">http://awads.net/wp/2006/09/19/cool-undocumented-sql-function-sys_op_map_nonnull-and-some-alternatives/#comment-50016</guid>
		<description>&lt;p&gt;sys_op_map_nonnull() is a little more subtle than nvl(x,&#039;0xff&#039;).&lt;/p&gt;

&lt;p&gt;The thing it maps to is an internally stored FF, and I don&#039;t think you can get this actual value stored for any type except RAW.  Then, to deal with the problem of comparing raws when using sys_op_mapnonnull(), sys_op_mapnonnull(ff) returns a two-byte value which is 00ff, so sys_op_map_nonnull(ff) != ff.&lt;/p&gt;
</description>
		<content:encoded><![CDATA[<p>sys_op_map_nonnull() is a little more subtle than nvl(x,&#8217;0xff&#8217;).</p>

<p>The thing it maps to is an internally stored FF, and I don&#8217;t think you can get this actual value stored for any type except RAW.  Then, to deal with the problem of comparing raws when using sys_op_mapnonnull(), sys_op_mapnonnull(ff) returns a two-byte value which is 00ff, so sys_op_map_nonnull(ff) != ff.</p>]]></content:encoded>
	</item>
	<item>
		<title>By: Eddie Awad</title>
		<link>http://awads.net/wp/2006/09/19/cool-undocumented-sql-function-sys_op_map_nonnull-and-some-alternatives/comment-page-1/#comment-50010</link>
		<dc:creator>Eddie Awad</dc:creator>
		<pubDate>Wed, 20 Sep 2006 16:39:16 +0000</pubDate>
		<guid isPermaLink="false">http://awads.net/wp/2006/09/19/cool-undocumented-sql-function-sys_op_map_nonnull-and-some-alternatives/#comment-50010</guid>
		<description>&lt;p&gt;Michael, I guess you have just found out why it&#039;s not documented. There are many other ways to compare two nulls, so there is really no need to use sys_op_map_nonnull. However, I will always be interested in the &quot;undocumented&quot;, just to satisfy my curiosity.&lt;/p&gt;
</description>
		<content:encoded><![CDATA[<p>Michael, I guess you have just found out why it&#8217;s not documented. There are many other ways to compare two nulls, so there is really no need to use sys_op_map_nonnull. However, I will always be interested in the &#8220;undocumented&#8221;, just to satisfy my curiosity.</p>]]></content:encoded>
	</item>
	<item>
		<title>By: Michael Friedman</title>
		<link>http://awads.net/wp/2006/09/19/cool-undocumented-sql-function-sys_op_map_nonnull-and-some-alternatives/comment-page-1/#comment-50008</link>
		<dc:creator>Michael Friedman</dc:creator>
		<pubDate>Wed, 20 Sep 2006 12:02:04 +0000</pubDate>
		<guid isPermaLink="false">http://awads.net/wp/2006/09/19/cool-undocumented-sql-function-sys_op_map_nonnull-and-some-alternatives/#comment-50008</guid>
		<description>&lt;p&gt;This would be a lot more interesting if it did not just act like nvl(x,&#039;FF&#039;).  What&#039;s the point?  You could have FF in your data.&lt;/p&gt;
</description>
		<content:encoded><![CDATA[<p>This would be a lot more interesting if it did not just act like nvl(x,&#8217;FF&#8217;).  What&#8217;s the point?  You could have FF in your data.</p>]]></content:encoded>
	</item>
	<item>
		<title>By: Eddie Awad</title>
		<link>http://awads.net/wp/2006/09/19/cool-undocumented-sql-function-sys_op_map_nonnull-and-some-alternatives/comment-page-1/#comment-50007</link>
		<dc:creator>Eddie Awad</dc:creator>
		<pubDate>Wed, 20 Sep 2006 04:29:56 +0000</pubDate>
		<guid isPermaLink="false">http://awads.net/wp/2006/09/19/cool-undocumented-sql-function-sys_op_map_nonnull-and-some-alternatives/#comment-50007</guid>
		<description>&lt;p&gt;Thanks for the extra tip Pete.&lt;/p&gt;
</description>
		<content:encoded><![CDATA[<p>Thanks for the extra tip Pete.</p>]]></content:encoded>
	</item>
	<item>
		<title>By: Pete_s</title>
		<link>http://awads.net/wp/2006/09/19/cool-undocumented-sql-function-sys_op_map_nonnull-and-some-alternatives/comment-page-1/#comment-50005</link>
		<dc:creator>Pete_s</dc:creator>
		<pubDate>Tue, 19 Sep 2006 15:46:46 +0000</pubDate>
		<guid isPermaLink="false">http://awads.net/wp/2006/09/19/cool-undocumented-sql-function-sys_op_map_nonnull-and-some-alternatives/#comment-50005</guid>
		<description>&lt;p&gt;Oracle uses this function in the &#039;default&#039; index on materialized views for fast refresh - which in the case of DW Mviews is a little odd as I would not expect NULLS in my fact summaries!&lt;/p&gt;
</description>
		<content:encoded><![CDATA[<p>Oracle uses this function in the &#8216;default&#8217; index on materialized views for fast refresh &#8211; which in the case of DW Mviews is a little odd as I would not expect NULLS in my fact summaries!</p>]]></content:encoded>
	</item>
</channel>
</rss>

