Home » SQL & PL/SQL » SQL & PL/SQL » Like with CLOB (Oracle Database 11g Enterprise Edition Release 11.2.0.3.0 - 64bit Production)
Like with CLOB [message #616279] Sat, 14 June 2014 17:19 Go to next message
manubatham20
Messages: 566
Registered: September 2010
Location: Seattle, WA, USA
Senior Member

Hi,

Can you please tell me why this is giving unexpected result, or I am using it incorrectly?

WITH temp AS (SELECT TO_CLOB ('A') COL FROM DUAL)
SELECT *
  FROM temp where COL like '%USA';


It should not return any row, but its returning one row.

Thanks,
Manu
Re: Like with CLOB [message #616281 is a reply to message #616279] Sat, 14 June 2014 18:18 Go to previous messageGo to next message
Lalit Kumar B
Messages: 3174
Registered: May 2013
Location: World Wide on the Web
Senior Member
Found exactly a same example here https://community.oracle.com/thread/2276249?tstart=0
Re: Like with CLOB [message #616288 is a reply to message #616279] Sun, 15 June 2014 02:39 Go to previous messageGo to next message
dariyoosh
Messages: 538
Registered: March 2009
Location: France
Senior Member
Here is what I get:

SQL> with temp as
  2  (
  3      select
  4          to_clob('A') col
  5      from
  6          "PUBLIC".dual
  7  )
  8  select
  9      t1.col
 10  from
 11      temp t1
 12  where
 13      t1.col like '%USA';

no rows selected

SQL> 


My oracle version: 12.1.0.1.0 - 64bit
Re: Like with CLOB [message #616289 is a reply to message #616288] Sun, 15 June 2014 02:47 Go to previous messageGo to next message
dariyoosh
Messages: 538
Registered: March 2009
Location: France
Senior Member
And I confirm that I've just run the same test on oracle 11.2.0.1.0 which gives that strange result !

SQL> with temp as
  2  (
  3      select
  4          to_clob('A') col
  5      from
  6          "PUBLIC".dual
  7  )
  8  select
  9      t1.col
 10  from
 11      temp t1
 12  where
 13      t1.col like '%USA';

COL
-------
A

SQL>
Re: Like with CLOB [message #616291 is a reply to message #616279] Sun, 15 June 2014 05:25 Go to previous messageGo to next message
Michel Cadot
Messages: 68643
Registered: March 2007
Location: Nanterre, France, http://...
Senior Member
Account Moderator

Seems a bug to report.
Maybe a known one, search on MOS/Metalink and/or raise a SR.
Let us know the answer you have from Oracle.

Re: Like with CLOB [message #616292 is a reply to message #616291] Sun, 15 June 2014 05:34 Go to previous message
Michel Cadot
Messages: 68643
Registered: March 2007
Location: Nanterre, France, http://...
Senior Member
Account Moderator

Also:
SQL>  create table t AS (SELECT TO_CLOB ('A') COL FROM DUAL);

Table created.

SQL> SELECT * FROM t where COL like '%USA';
COL
---------------------------------------------------------------
A

1 row selected.

This fuzzily reminds me something in an older version, I will search in my archives.

Previous Topic: Delete statement is taking long time. Please suggest.
Next Topic: function
Goto Forum:
  


Current Time: Tue Apr 23 18:37:42 CDT 2024