Hello, everyone.
In Oracle (10g and 11g), can COALESCE() be nested inside MAX()?
For example, I want to get the current MAX value of a column used for sort order of records (ie, 1,2,3,4..) for a particular application listing; going to add one to it and use it for the next entry for that app. So I was using
Code:
SELECT MAX(sort_order)+1 FROM table WHERE app_id = 'F8'
But then it occurred to me that when an application is being entered for the first time, there won't be a sort order (separate table for applications.) So, I'm wondering if I could do:
Code:
SELECT MAX(COALESCE(sort_order,0))+1 FROM table WHERE app_id = 'F8'
UPDATE: Apparently, yes, it can.
Respectfully,