<?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/"
		>
<channel>
	<title>Comments on: How to use LIKE operator in DECODE function</title>
	<atom:link href="http://oraqa.com/2006/04/12/how-to-use-like-operator-in-decode-function/feed/" rel="self" type="application/rss+xml" />
	<link>http://oraqa.com/2006/04/12/how-to-use-like-operator-in-decode-function/</link>
	<description>Oracle Question and Answer</description>
	<lastBuildDate>Sat, 07 Aug 2010 04:48:56 -0600</lastBuildDate>
	<generator>http://wordpress.org/?v=2.8.4</generator>
	<sy:updatePeriod>hourly</sy:updatePeriod>
	<sy:updateFrequency>1</sy:updateFrequency>
		<item>
		<title>By: Claudiu Ariton</title>
		<link>http://oraqa.com/2006/04/12/how-to-use-like-operator-in-decode-function/comment-page-1/#comment-189</link>
		<dc:creator>Claudiu Ariton</dc:creator>
		<pubDate>Fri, 23 Jun 2006 09:26:11 +0000</pubDate>
		<guid isPermaLink="false">http://oraqa.com/2006/04/12/how-to-use-like-operator-in-decode-function/#comment-189</guid>
		<description>Hello,

 In 8i version:

 select (case when 1=1 then 1 else 0 end) test from dual; - works in SQL, but not works in PLSQL

   1  declare
  2  cursor c is select (case when 1=1 then 1 else 0 end) test
  3   from dual;
  4  begin
  5  null;
  6* end;
SQL&gt; /
cursor c is select (case when 1=1 then 1 else 0 end) test
                    *
EROARE la linia 2:
ORA-06550: line 2, column 21:
PLS-00103: Encountered the symbol &quot;CASE&quot; when expecting one of the following:
( - + mod not null others 

 Thank you,
 Claudiu</description>
		<content:encoded><![CDATA[<p>Hello,</p>
<p> In 8i version:</p>
<p> select (case when 1=1 then 1 else 0 end) test from dual; &#8211; works in SQL, but not works in PLSQL</p>
<p>   1  declare<br />
  2  cursor c is select (case when 1=1 then 1 else 0 end) test<br />
  3   from dual;<br />
  4  begin<br />
  5  null;<br />
  6* end;<br />
SQL&gt; /<br />
cursor c is select (case when 1=1 then 1 else 0 end) test<br />
                    *<br />
EROARE la linia 2:<br />
ORA-06550: line 2, column 21:<br />
PLS-00103: Encountered the symbol &#8220;CASE&#8221; when expecting one of the following:<br />
( &#8211; + mod not null others </p>
<p> Thank you,<br />
 Claudiu</p>
]]></content:encoded>
	</item>
	<item>
		<title>By: Laurent Schneider</title>
		<link>http://oraqa.com/2006/04/12/how-to-use-like-operator-in-decode-function/comment-page-1/#comment-188</link>
		<dc:creator>Laurent Schneider</dc:creator>
		<pubDate>Mon, 19 Jun 2006 18:00:45 +0000</pubDate>
		<guid isPermaLink="false">http://oraqa.com/2006/04/12/how-to-use-like-operator-in-decode-function/#comment-188</guid>
		<description>[code]
select decode(substr(ename,1,1),&#039;A&#039;,&#039;stringA&#039;,&#039;M&#039;,&#039;stringM&#039;) from emp;
[/code]

in this case</description>
		<content:encoded><![CDATA[<p>[code]<br />
select decode(substr(ename,1,1),'A','stringA','M','stringM') from emp;<br />
[/code]</p>
<p>in this case</p>
]]></content:encoded>
	</item>
	<item>
		<title>By: TMoore</title>
		<link>http://oraqa.com/2006/04/12/how-to-use-like-operator-in-decode-function/comment-page-1/#comment-187</link>
		<dc:creator>TMoore</dc:creator>
		<pubDate>Sun, 18 Jun 2006 20:46:28 +0000</pubDate>
		<guid isPermaLink="false">http://oraqa.com/2006/04/12/how-to-use-like-operator-in-decode-function/#comment-187</guid>
		<description>When I have to write huge DECODE a translate it into CASE. 
It&#039;s much more flexible.
It was in 8i too, try it ( Some people said it wasn&#039;t CUBE, ROLLUP in 8i It was myth) 
For more then 3 condition statement i use CASE, for simple 2 conds DECODE is quicker to write.

..

select
case 
when name like &#039;A%&#039; then &#039;String begin with A&#039;
when name like &#039;M%&#039; then &#039;String begin with M&#039;
end as &#039;result&#039;
from emp
/


cheers</description>
		<content:encoded><![CDATA[<p>When I have to write huge DECODE a translate it into CASE.<br />
It&#8217;s much more flexible.<br />
It was in 8i too, try it ( Some people said it wasn&#8217;t CUBE, ROLLUP in 8i It was myth)<br />
For more then 3 condition statement i use CASE, for simple 2 conds DECODE is quicker to write.</p>
<p>..</p>
<p>select<br />
case<br />
when name like &#8216;A%&#8217; then &#8216;String begin with A&#8217;<br />
when name like &#8216;M%&#8217; then &#8216;String begin with M&#8217;<br />
end as &#8216;result&#8217;<br />
from emp<br />
/</p>
<p>cheers</p>
]]></content:encoded>
	</item>
	<item>
		<title>By: Laurent Schneider</title>
		<link>http://oraqa.com/2006/04/12/how-to-use-like-operator-in-decode-function/comment-page-1/#comment-185</link>
		<dc:creator>Laurent Schneider</dc:creator>
		<pubDate>Thu, 01 Jun 2006 19:05:45 +0000</pubDate>
		<guid isPermaLink="false">http://oraqa.com/2006/04/12/how-to-use-like-operator-in-decode-function/#comment-185</guid>
		<description>do you really need it? translating &quot;like&quot; in multiple instr is possible, but I advise you to upgrade to a supported release of Oracle (for example 10gR2)</description>
		<content:encoded><![CDATA[<p>do you really need it? translating &#8220;like&#8221; in multiple instr is possible, but I advise you to upgrade to a supported release of Oracle (for example 10gR2)</p>
]]></content:encoded>
	</item>
	<item>
		<title>By: Claudiu Ariton</title>
		<link>http://oraqa.com/2006/04/12/how-to-use-like-operator-in-decode-function/comment-page-1/#comment-184</link>
		<dc:creator>Claudiu Ariton</dc:creator>
		<pubDate>Thu, 01 Jun 2006 10:28:36 +0000</pubDate>
		<guid isPermaLink="false">http://oraqa.com/2006/04/12/how-to-use-like-operator-in-decode-function/#comment-184</guid>
		<description>Hello,

 You are rigth but ....
 The CASE operator is not working in Oracle 8i version and the INSTR function is limited than DECODE. Try to re-write the query like this with INSTR function:

Select
 decode(NAME, (select name from dual where name like &#039;A%R_D_E%&#039;), &#039;ARDE&#039;,
     (select name from dual where name like &#039;M%&#039;), &#039;M&#039;,null)
From EMP;

 Claudiu Ariton</description>
		<content:encoded><![CDATA[<p>Hello,</p>
<p> You are rigth but &#8230;.<br />
 The CASE operator is not working in Oracle 8i version and the INSTR function is limited than DECODE. Try to re-write the query like this with INSTR function:</p>
<p>Select<br />
 decode(NAME, (select name from dual where name like &#8216;A%R_D_E%&#8217;), &#8216;ARDE&#8217;,<br />
     (select name from dual where name like &#8216;M%&#8217;), &#8216;M&#8217;,null)<br />
From EMP;</p>
<p> Claudiu Ariton</p>
]]></content:encoded>
	</item>
	<item>
		<title>By: Laurent Schneider</title>
		<link>http://oraqa.com/2006/04/12/how-to-use-like-operator-in-decode-function/comment-page-1/#comment-183</link>
		<dc:creator>Laurent Schneider</dc:creator>
		<pubDate>Thu, 01 Jun 2006 09:35:54 +0000</pubDate>
		<guid isPermaLink="false">http://oraqa.com/2006/04/12/how-to-use-like-operator-in-decode-function/#comment-183</guid>
		<description>or with case

select ename,
  case
    when ename like &#039;A%&#039; then &#039;A&#039;
    when ename like &#039;M%&#039; then &#039;M&#039; 
  end 
from emp;</description>
		<content:encoded><![CDATA[<p>or with case</p>
<p>select ename,<br />
  case<br />
    when ename like &#8216;A%&#8217; then &#8216;A&#8217;<br />
    when ename like &#8216;M%&#8217; then &#8216;M&#8217;<br />
  end<br />
from emp;</p>
]]></content:encoded>
	</item>
	<item>
		<title>By: Laurent Schneider</title>
		<link>http://oraqa.com/2006/04/12/how-to-use-like-operator-in-decode-function/comment-page-1/#comment-182</link>
		<dc:creator>Laurent Schneider</dc:creator>
		<pubDate>Thu, 01 Jun 2006 09:33:59 +0000</pubDate>
		<guid isPermaLink="false">http://oraqa.com/2006/04/12/how-to-use-like-operator-in-decode-function/#comment-182</guid>
		<description>select 
  ename,
  decode(instr(ename,&#039;M&#039;),1,&#039;M&#039;,
    decode(instr(ename,&#039;A&#039;),1,&#039;A&#039;)) 
from emp;</description>
		<content:encoded><![CDATA[<p>select<br />
  ename,<br />
  decode(instr(ename,&#8217;M'),1,&#8217;M',<br />
    decode(instr(ename,&#8217;A'),1,&#8217;A'))<br />
from emp;</p>
]]></content:encoded>
	</item>
</channel>
</rss>
