Oracle FAQ | Your Portal to the Oracle Knowledge Grid |
![]() |
![]() |
Home -> Community -> Usenet -> c.d.o.server -> Problem in SELECT ... WHERE ... IN
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
![]() |
![]() |