Consultor Eletrônico



Kbase P44784: SQL-92 query uses correct index if run from SQL Explorer too
Autor   Progress Software Corporation - Progress
Acesso   Público
Publicação   09/10/2003
Status: Unverified

FACT(s) (Environment):

Windows

FACT(s) (Environment):

Progress 9.1D

SYMPTOM(s):

SQL-92 query uses correct index if run from SQL Explorer tool and performs a table scan when run from a Stored Procedure.

CAUSE:

Had the following code inside the stored procedure to give the SQLCursor its parameters:
csr.setParam (i, in_last_name + "%");
csr.setParam (i, in_first_name + "%");

FIX:

Referencing the parameters into the SQL query itself resolved this issue:

SQLCursor csr = new SQLCursor ("select ca.\"addr-id\" from pub.consumer c where c.\"last-name\" like '" + in_last_name + "%' and c.\"first-name\" like '" + in_first_name + "%'");