Bind variables react differently in PL/SQL developer and Toad
Hi all, When trying to improve the performance of my query i have created an index on a table for the column employee_number with datatype NUMBER(9). The query that i'm using is using Bind variables, these are necessary because this query will be deployed as a rest service in Oracle Apex. When building the query in PL/SQL developer(version 12) i declare my bind variables like this: <code>with params as (select to_number('&supplier_number') supplier_number, to_char('&employee_numbers') employee_numbers from dual)</code> Since it's possible to supply more employee_numbers i have another with statement to handle those: <code>( select to_number(trim(regexp_substr(params.employee_numbers, '[^,]+', 1, level))) as employee_number from params connect by regexp_substr(params.employee_numbers, '[^,]+', 1, level) is not null ),</code> Now, when i go to the where statement of the actual query, i do this: <code>and (employee_numbers is null or xsd.employee_number in employee_numbers.employee_number)</code> When i execute that query it runs using the index that i created. However, when executing that exact same query in Toad(and also executing it as a rest service) i have to declare the bind variables like this: <code>with params as (select to_number(:supplier_number) supplier_number, to_char(:employee_numbers) employee_numbers from dual)</code> And when executing the exact same query, it uses completely different indexes which make the query incredibly slow. It seems like PL/SQL developer does something with the '&variable' that toad or other ide's don't seem to do with :variable. And even though i make sure the datatype's are correct using to_number and to_char, it reacts different. Does anyone know what the difference is? Many thanks in advance!
Bind variables react differently in PL/SQL developer and Toad