Re: Query Help Needed

From: Tony Hunt <tonster_at_bigpond.net.au>
Date: Wed, 03 Oct 2001 10:01:58 GMT
Message-ID: <qmBu7.116507$bY5.579732_at_news-server.bigpond.net.au>


I'm a bit confused by what you intend a 'correct comparison' to be?

In your case INSTR returns a numerical value for the character position of the 1st occurence of ColumnB in ColumnA. The row is returned below because the INSTR return value is '0' meaning that 'Dept1' is not found in 'Dept1C,Dept99' at all...

"GZ" <gz_at_yahoo.com> wrote in message news:3BBA478E.17C6B717_at_yahoo.com...
> I would like to know if there is a way to compare two similar but not
> exactly the same strings in a where clause. I am using the INSTR
> function to do this as below but it does not do a valid comparision.
> Using ColumnA = ColumnB is not an option here nor is PL/SQL.
>
> The query below returns row one of the table but I do not want this row
> returned.
>
> select * from My_Table where INSTR(ColumnA, ColumnB) = 0
>
> The row is returned because it finds that Dept1 is in the string of
> ColumnA. Is there a way so that the correct comparison of
> Dept1--->Dept1C is performed and that row is therefore not returned?
>
>
> My_Table
> -----------
>
> ColumnA ColumnB
> ----------- -----------
>
> Dept1C,Dept99 Dept1
>
>
> Any help would be much appreciated.
>
> Thanks,
>
> Greg
>
Received on Wed Oct 03 2001 - 12:01:58 CEST

Original text of this message