Go Back   CodingForums.com > :: Server side development > MySQL > Other Databases

Before you post, read our: Rules & Posting Guidelines

Reply
 
Thread Tools Rate Thread
Enjoy an ad free experience by logging in. Not a member yet? Register.
Old 08-02-2012, 06:04 PM   PM User | #1
WolfShade
Regular Coder

 
Join Date: Apr 2012
Location: St. Louis, MO, USA
Posts: 946
Thanks: 7
Thanked 97 Times in 97 Posts
WolfShade is an unknown quantity at this point
ORACLE: Can COALESCE() be nested inside MAX()?

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,
__________________
^_^

If anyone knows of a website that can offer ColdFusion help that isn't controlled by neurotic, pedantic jerks* (stackoverflow.com), please PM me with a link.
*
The neurotic, pedantic jerks are not the owners; just the people who are in control of the "popularity contest".

Last edited by WolfShade; 08-03-2012 at 06:18 PM..
WolfShade is offline   Reply With Quote
Reply

Bookmarks

Tags
10g, 11g, coalesce, max, oracle

Jump To Top of Thread


Thread Tools
Rate This Thread
Rate This Thread:

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off

Forum Jump


All times are GMT +1. The time now is 12:13 PM.


Advertisement
Log in to turn off these ads.