Hello folks,
I am trying to output results from a table based on a String which I was planning on using in the "IN" clause. When I run the query through the PL/SQL procedure, I get no results.
In the PL/SQL program, I have a variable p_string where I am appending the ID's in a loop. So, when I print the string, I am seeing '1001','1002','1003' but when I do the following I get nothing.
select * from test_tb
where ID IN (p_string);
Is this because there is an extra quote at the beginning and end of the string and the string is actually ''1001','1002','1003''?
create table test_tb(ID varchar2(4), description varchar2(20));
INSERT INTO TEST_TB (ID, DESCRIPTION) VALUES ('1001', 'Testing 1001');
INSERT INTO TEST_TB (ID, DESCRIPTION) VALUES ('1002', 'Testing 1002');
INSERT INTO TEST_TB (ID, DESCRIPTION) VALUES ('1003', 'Testing 1003');
INSERT INTO TEST_TB (ID, DESCRIPTION) VALUES ('1004', 'Testing 1004');
INSERT INTO TEST_TB (ID, DESCRIPTION) VALUES ('1005', 'Testing 1005');
Thanks