not equal statement
572758Jun 29 2007 — edited Jul 2 2007I have two massive tables. I open a cursor as a select statement from table 1 and I have to go against table2. Below is a part of my code. I have a text book which says if I use the NON EQUAL statement all the indexes will be ignored.
It takes too long to run the procedure. I was wondering if I am not using the index at all becuase of the "val2 != :val2" part of the statement. Is there any other way I could write this.
Thank you!
execute immediate
'select count(*)
from tbl2_'||year ||'
where val1= :val1
and val_date = :val_date
and val_num = :val_num
and val2 != :val2
and trans_date = :trans_date
'
into v_count
using v_row.val1, v_row.val_date, v_row.val_num,
v_row.val2, v_row.trans_date;
if v_count = 0
then
GOTO continue;
end if;