Problem : SQL statement with inequalities in the predicate. Rewrite?

Problem : SQL statement with inequalities in the predicate.  Rewrite?

During some routine performance profiling in Oracle, I got the following flagged SQL statement and recommendations:

SQL Text:
SELECT * FROM orders b WHERE id != :p1 AND order_number = :p2

Findings:
Predicate “B”.”ID”<>TO_NUMBER(:B1) used at line ID 1 of the execution plan is an inequality condition on indexed column “ID”. This inequality condition prevents the optimizer from selecting indices on table “OIC”.”ORDERS”.

Recommendations:
Rewrite the predicate into an equivalent form to take advantage of indices.

Rationale:
The optimizer is unable to use an index if the predicate is an inequality condition or if there is an expression or an implicit data type conversion on the indexed column.

Problem: I don’t know of any way to write that unless it’s using an
inequality predicate.  How could I change this query so the index is used?


Solution: SQL statement with inequalities in the predicate.  Rewrite?

to improve the query performance,
I suggest you to create an index on the ORDER_NUMBER column