It may be worth mentioning that neither of the above worked for me in an Oracle 19c database today.
SITUATION
I had created a function that I could query like a table.
(A PIPELINED function returning a custom data type).
In the loop to return a (modified) row of data, I wanted to take a parameter from the function call and use a LIKE to identify the right data.
I started with hard coded values, and everything worked fine.
When I moved to dynamically assigning the value for the like, in the ways mentioned in the answer by @MatBailie and @ypercube™.
Neither worked.
FIX
What DID work, however was to do the following:
- Create a local variable to set the value from the parameter and concatenate in '%' (so the final value was the string passed as well as % @ the end of that string). That code was
localVariable := parameterPassedToFunction||'%';
- In the query where the LIKE was required I used the following:
LIKE''||localVariable
Hope that helps someone in the future.