Skip to Main Content

SQL & PL/SQL

Announcement

For appeals, questions and feedback about Oracle Forums, please email oracle-forums-moderators_us@oracle.com. Technical questions should be asked in the appropriate category. Thank you!

Interested in getting your voice heard by members of the Developer Marketing team at Oracle? Check out this post for AppDev or this post for AI focus group information.

not equal statement

572758Jun 29 2007 — edited Jul 2 2007
I 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;
Comments
Locked Post
New comments cannot be posted to this locked post.
Post Details
Locked on Jul 30 2007
Added on Jun 29 2007
2 comments
394 views