So ideally I'd like to keep this within a query, but if it's not possible, I suppose a package could work as I have no webapp level to work with.
What I'd like to do is this, for an Oracle DB, create/run a query in the where
clause such that for each row in a table with one attribute where all rows have substrings with wildcards are stored it adds on to the search string for contains
. Since to my knowledge, you can't really do loops within queries, one would need a cursor, but I've never used cursors. Here is a more visual representation of what I'm trying to do (abet with loop logic):
Table1
Attribute: firstname
John
Joe
Jane
Josephine
Table2
Attribute: substrings
%se%
%h%i%
Where by constraint there is guaranteed to always be at least one row
Pseudo Query
SELECT
table1.firstname
FROM
table1
WHERE CONTAINS(table1.firstname, '"table2.row1"
IF(count(table2.substrings) > 1)
FOR table2.row = 2 TO count(table2.substrings)
(
+ " OR row.substrings"
)
', 1) > 0
(CONTAINS
syntax based on Is there a combination of "LIKE" and "IN" in SQL?)