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 -> Problem in SELECT ... WHERE ... IN

Problem in SELECT ... WHERE ... IN

From: lamtse <lamtse_at_ims06.netvigator.com>
Date: Sun, 14 Mar 1999 15:51:43 +0800
Message-ID: <7cfpr0$l1$1@imsp009a.netvigator.com>


Dear Oracle experts,

    I have the following problem: The following SQL is okay:

insert into table_1
select column_1 from table_2
where column_2 IN ('KG' and 'GD');

  However, if I put 'KG' and 'GD' in a variable and execute the same SQL, no rows are inserted to table_1:

declare

   string_1 VARCHAR2(100);
begin

   string_1 := ''''||'KG'||''''||','||''''||'GD'||'''';    dbms_output.put_line(string_1);
   insert into table_1
   select column_1 from table_2
   where column_2 IN (string_1);
end;

The above will show 'KG','GD' on screen of SQL Plus but no row has been inserted to table_1.
Any idea what has gone wrong?

Thanks for your help!

D. Lam Received on Sun Mar 14 1999 - 01:51:43 CST

Original text of this message

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