dive into mark

You are here: dive into markArchivesAugust 2001Ask Doctor SQL, Oracle edition

Wednesday, August 1, 2001

Ask Doctor SQL, Oracle edition

Here’s an Oracle version of the same query:

select data.*
, derived_table.position
from data
, (select a.id, sum(nvl(b.length, 0)) position
   from data a
   , data b
   where b.id(+) < a.id
   group by a.id
) derived_table
where data.id = derived_table.id

Oracle uses NVL instead of COALESCE, and its own join syntax instead of ANSI-92 joins, but the concepts are the same.

Filed under ,

Respond privately

I am no longer accepting public comments on this post, but you can use this form to contact me privately. (Your message will not be published.)



Recent Stuff For You, Special Price Stay Here
  • Greasemonkey Hacks
Good Stuff Buy The Cow Go Away
Dive Into Python
Powered by Google Drink The Milk Don't Steal

 

posts / comments
© 2001-8 Mark Pilgrim