I got an confusing result when working with rownum of Oracle10g.
select * from A where name like '%test' order by name asc
==> return 1 record
select * from (
select * from A where name like '%test'
order by name asc
)
where rownum <= 2
==> return 2 records
If I remove 'order by' then it will return 1 record.
Any one can help me to explain this behavior?
The following recommendations will help you in your SQL tuning process.
You'll find 3 sections below:
CREATE INDEX a_idx_name ON A (name);
SELECT
*
FROM
A
WHERE
A.name LIKE '%test'
ORDER BY
A.name ASC