SV: compare two columns (oracle 9i)

  • From: Michael Garfield Sørensen, CeDeT <mgs@xxxxxxxx>
  • To: <mssql_2002@xxxxxxxxx>, <oracle-l@xxxxxxxxxxxxx>
  • Date: Thu, 13 Apr 2006 22:41:03 +0200

Me thinks you mean:

select col2 from r1,r2 where col2 like '%'||col1||'%';

- i.e. compare col2 with the contents of col1 not the (sub-)string 'col1'!

HTH
Michael


-----Oprindelig meddelelse-----
Fra: oracle-l-bounce@xxxxxxxxxxxxx [mailto:oracle-l-bounce@xxxxxxxxxxxxx] På
vegne af Bob Robert
Sendt: 13. april 2006 22:32
Til: oracle-l@xxxxxxxxxxxxx
Emne: compare two columns (oracle 9i)

Gurus,

I would like to compare two columns from two different tables without
creating cursor. Is it possible?

create table r1 (col1 varchar2(10));
create table r2 (col2 varchar2(15));
insert into r1 values ('TEVE');
insert into r2 values ('STEVE');
insert into r1 values ('OM');
insert into r2 values ('TOM');
insert into r1 values ('JIM');
insert into r2 values ('BUSH');

SQL> select col1 from r1;

COL1
----------
TEVE
OM
JIM

SQL> select col2 from r2;

COL2
---------------
STEVE
TOM
BUSH

SQL> select col2 from r1,r2 where col2 like '%col1%';

no rows selected

Above Query doesn't return any rows?

Thanks
Bob


__________________________________________________
Do You Yahoo!?
Tired of spam?  Yahoo! Mail has the best spam protection around 
http://mail.yahoo.com 
--
//www.freelists.org/webpage/oracle-l





--
//www.freelists.org/webpage/oracle-l


Other related posts:

  • » SV: compare two columns (oracle 9i)