Return-Path: <ml-errors@fatcity.com>
Received: from ensim.rackshack.net (root@localhost)
 by orafaq.net (8.11.6/8.11.6) with ESMTP id h7K290m29267
 for <oracle-l@orafaq.net>; Tue, 19 Aug 2003 21:09:00 -0500
X-ClientAddr: 66.27.56.213
Received: from www2.fatcity.com (rrcs-west-66-27-56-213.biz.rr.com [66.27.56.213])
 by ensim.rackshack.net (8.11.6/8.11.6) with ESMTP id h7K290p29261
 for <oracle-l@orafaq.net>; Tue, 19 Aug 2003 21:09:00 -0500
Received: (from root@localhost)
 by www2.fatcity.com (8.11.6/8.11.6) id h7JNfPY01156
 for oracle-l@orafaq.net; Tue, 19 Aug 2003 16:41:25 -0700
Received: by fatcity.com (05-Jun-2003/v1.0g-b73/bab) via fatcity.com id 005CB9B1; Tue, 19 Aug 2003 16:34:24 -0800
Message-ID: <F001.005CB9B1.20030819163424@fatcity.com>
Date: Tue, 19 Aug 2003 16:34:24 -0800
To: Multiple recipients of list ORACLE-L <ORACLE-L@fatcity.com>
X-Comment: Oracle RDBMS Community Forum
X-Sender: Scott Lamb <slamb@slamb.org>
Sender: ml-errors@fatcity.com
Reply-To: ORACLE-L@fatcity.com
Errors-To: ML-ERRORS@fatcity.com
From: Scott Lamb <slamb@slamb.org>
Subject: Re: select strings with '_' in it
Organization: Fat City Network Services, San Diego, California
X-ListServer: v1.0g, build 73; ListGuru (c) 1996-2003 Bruce A. Bergman
Precedence: bulk
Mime-Version: 1.0
Content-Type: text/plain; charset=us-ascii; format=flowed
Content-Transfer-Encoding: 7bit

Tanel Poder wrote:

> Hi!
>  
> I think translate is overkill here.
>  
> Use:
>  
> select col from tab where col like 'v\_lan' escape '\';

vs

 >     Select col1 from table
 >     where translate(col1,'_','#') like 'v#lan%'
 >     /

Not only is the escape method cleaner, it's much more efficient. Unless 
you have an index on translate(col1,'_','#') (unlikely), that query will 
always result in a sequential scan. Ugh.

-- 
Please see the official ORACLE-L FAQ: http://www.orafaq.net
-- 
Author: Scott Lamb
  INET: slamb@slamb.org

Fat City Network Services    -- 858-538-5051 http://www.fatcity.com
San Diego, California        -- Mailing list and web hosting services
---------------------------------------------------------------------
To REMOVE yourself from this mailing list, send an E-Mail message
to: ListGuru@fatcity.com (note EXACT spelling of 'ListGuru') and in
the message BODY, include a line containing: UNSUB ORACLE-L
(or the name of mailing list you want to be removed from).  You may
also send the HELP command for other information (like subscribing).

