sql - Using Order By in IN condition -
let's have silly query:
select * emp id in (select id emp) let's small modification inside in condition adding order by clause.
select * mail id in (select id mail order id) then getting following error:
ora-00907: missing right parenthesis
oracle assumes in condition end after declaring table. result waits right parenthesis, give order instead. why can't add order inside in condition?
fyi: don't ask equivalent query. example after all. can't understand why error occurs.
consider condition x in (select somewhere). returns true if x equal of somethings returned query - regardless of whether it's first, second, last, or in middle. order somethings returned inconsequential. adding order by clause query comes hefty performance hit, i'm guessing this limitation introduced prevent adding clause has no impact on query's correctness on 1 hand , may quite expensive on other.
Comments
Post a Comment