|
|
You can change your SQL as
SELECT COUNT(custID) custID
FROM DW_VCustEntrust
WHERE uploaddate
BETWEEN to_date(:v1,'YYYY-MM-DD')
AND to_date(:v2,'YYYY-MM-DD')
and DW_VCustEntrust.entrustType=:v3;
for :v1 and :v2, you can declare it as Varchar and input the values.
If you find the execution time is slow, that reflects the true execution time of the SQL statement during execution.
If the speed is good or the same as what you tested in SQL*Plus, that means Oracle has an unstable optimization behaivour during your problem execution. You can use an optimized SQL statement with hints control from SQL Expert to enfore an stable plan generatioin. Use this hints specified SQL and replace your program's SQL to execute again, I think that may solve your problem. |
|