Oracle FAQ Your Portal to the Oracle Knowledge Grid
HOME | ASK QUESTION | ADD INFO | SEARCH | E-MAIL US
 

Home -> Community -> Usenet -> c.d.o.server -> Re: Query Problem

Re: Query Problem

From: <sshipe_at_worldnet.att.net>
Date: 1998/01/22
Message-ID: <885487382.674234370@dejanews.com>#1/1

> The following query return zero records.
>
> Query1
> ==============================================
> Select a.comp, b.tel from tab_comp a, tab_tel b
> where a.key1 = b.key1 and a.key2 = b.key2
>
> but add a rtrim() function to the query, it works
>
> Query2
> ==============================================
> Select a.comp, b.tel from tab_comp a, tab_tel b
> where a.key1 = b.key1 and a.key2 = rtrim(b.key2)
>

key2 must be a char column. Updating it to trim off rightmost blanks merely adds the trimmed blanks back on because char is not varchar. If key2 were varchar, then this would work. The reason the query works with rtrim(b.key2), is that a.key2 will be turned into a varchar for comparision to rtrim(b.key2). Check your plan for verification of this by using showplan on.

-------------------==== Posted via Deja News ====-----------------------
      http://www.dejanews.com/     Search, Read, Post to Usenet
Received on Thu Jan 22 1998 - 00:00:00 CST

Original text of this message

HOME | ASK QUESTION | ADD INFO | SEARCH | E-MAIL US