Use bind variable using LIKE% operator

My PL / SQL has this big dynamic SQL using bind variables. I use the DBMS_SQL package to bind and execute a generated query.

According to certain criteria, where-clauses clauses are added to dynamic SQL. When I just use "in" or "=" to match my bind variables, everything works fine and the results come back pretty quickly.

Example:

(servedparty = :bv_ or servedpartyimsi = :bv_)

However, when I do the following:

(servedpartyimei like :bv_)

and provide a value like 12345679890%, the request takes a very very long time.

I also tried something like this

(servedpartyimei like :bv_||'%')

and then specify the value without "%", but it gives the same results

, , .

- ? LIKE? ?

.

+4
2

, Oracle 9197434 (BIND PEEKING DBMS_SQL)

, .

Oracle , LIKE. , "%". , Oracle , LIKE . , , Oracle , ( , ), , ( -, ).

Native Dynamic SQL (.. EXECUTE IMMEDIATE), , . SQL.

+4

LIKE , Oracle , . , ( ), 5%, 10%, . .

( ) _like_with_bind_as_equality, , , .. true, , column like :bv, , column = :bv. , , . alter session.

+3

Source: https://habr.com/ru/post/1661085/


All Articles