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!

using LAG() and MIN() functions

574757Dec 3 2008 — edited Dec 3 2008
So, i am trying to get the smallest number from an aliased column that i am using LAG() in. I know, that does not make sense, so here is what im trying to do with a SQL statement:

select MIN(NUM1 - lag(num1,1,0)) over(ORDER BY NUM1) AS HEY from J_LAG ORDER BY HEY

basically, i want the smallest number from the column that i run the lag function on. When I try to do this it says, "ORA-30484: missing window specification for this function". I have tried putting the min's brackets like this: MIN(NUM1 - lag(num1,1,0)) and like this: MIN(NUM1 - lag(num1,1,0) over(ORDER BY NUM1)) and neither of them seem to work.

Any ideas??

-- Joshua
This post has been answered by NicloeiW on Dec 3 2008
Jump to Answer
Comments
Locked Post
New comments cannot be posted to this locked post.
Post Details
Locked on Dec 31 2008
Added on Dec 3 2008
2 comments
1,672 views