RE
GJ, February 08, 2017 - 10:00 am UTC
Is this going to be a user who is going to pickup those 50000 values for use by the procedure via a reporting screen perhaps?. It seems very unlikely.
Another possibility is that a program which is going to feed these 50000 values? then it begs for a join with the source_table_with_50000 values /gtt lookup.
multiple search value using like
A reader, February 08, 2017 - 2:55 pm UTC
CREATE TABLE NAMES(Id integer PRIMARY KEY, Name text);
INSERT INTO NAMES VALUES(1,'one,');
INSERT INTO NAMES VALUES(2,'two,');
INSERT INTO NAMES VALUES(3,'two,one,');
INSERT INTO NAMES VALUES(4,'three,');
INSERT INTO NAMES VALUES(5,'one,three');
COMMIT;
Now I fire below query.
SELECT * FROM NAMES where name like ('%one%','%two%');
then i get error so what's other way to search multiple value.
February 10, 2017 - 5:20 pm UTC
Same approach of a temp table will work
select *
from my_table t,
gtt
where t.col like gtt.col||'%'
use regexp_like
Peter, February 08, 2017 - 5:36 pm UTC
Hi, you can use:
SELECT
*
FROM
NAMES
WHERE
REGEXP_LIKE(NAME,'one|two')
ID NAME
-- -------------------------
1 one,
2 two,
3 two,one,
5 one,three
Thanks
A reader, February 11, 2017 - 4:06 pm UTC
Thanks Connor,
I have tried second approach and it is really creating long SQL. Will try using GTT now.
matching all values from IN clause
Neeraj Bedi, October 05, 2017 - 9:02 pm UTC
I have a table where there are multiple values corresponding to one single value(1:n table)
I want to query and find out the parent value if all the supplied values exist for the parent.
for eg, for below set of data in a table:
name1 val1
name1 val2
name1 val3
name2 bval1
name2 bval2
name3 val98
name3 val99
name3 val100
name4 val100
name4 val10
i want to supply the below input, and expect the mentioned result:
abc, val2,val3 return name1
bval1 return nothing
val100,val10 return name4
val100,val10,val11 return nothing
I would like to know is this possible using an IN query or it'd require something else.
Thanks for your help.
October 06, 2017 - 5:35 am UTC