In my PL/SQL have this big dynamic SQL using bind variables. I use the DBMS_SQL package to bind and execute the generated query.
Based on certain criteria, where-clauses are added to the dynamic SQL. When I just use an "in" or a "=" to match my bind variables all works fine and results are returned pretty fast.
Example:
(servedparty = :bv_ or servedpartyimsi = :bv_)
However, when I do the following:
(servedpartyimei like :bv_)
and provide a value like 12345679890% the query takes a very very very long time.
I've also tried somehting like this
(servedpartyimei like :bv_||'%')
and then provide the value without the '%' but it gives the same results
When I execute the query without bind variables but just put hardcoded values, result are also returned immediatly.
Am I doing something wrong here? Don't bind variables like the LIKE operator? Any ideas?
Thank you.