|
-
Chris,
You ar ecorrect again with your answer. When I suggeted the use of ROW_NUM() function I didn't correctly understand what pando wants - I thought he wants to select persons for every city, but at the same time to limit the number of persons per city to 3. Now you've comme with the right function for his actual bussines rule.
As regarding the CASE operator (or is it a function?):
I would say FINALY! AFAIK other databases supported CASE for quite a long time before Oracle included it in 8.1.6. I said FINALY, but at the same time something in me says: "Argh, I have developed quite a few tricks and techniques in using DECODE, now I will not be able to show around with those tricks anymore;) . Seriously, it is funny that some of techniques with DECODE were not published widely (or not published at all), for example how to avoid nesting decodes in complicated IF-ELSIF logic, how to implement range operators (GREATER THEN, ....) in decode and so on. I've had a presentation at our local usergroup conference devoted entirely to DECODE.
But seriously, the introduction of CASE in oracle is true relief! When I had to read my own decode construct few weeks after I've wrote them, I had to study their logic again from the beginning. The logic of the complicated DECODEs is usually so hard to "decode", while now you look at CASE once and its logic is immediatelly selfunderstandable.
BTW, the railroad diagram of CASE in 8.1.6 documentation has bug - there should be no comma (,) between subsequent WHEN comparisons.
Jurij Modic
ASCII a stupid question, get a stupid ANSI
24 hours in a day .... 24 beer in a case .... coincidence?
Posting Permissions
- You may not post new threads
- You may not post replies
- You may not post attachments
- You may not edit your posts
-
Forum Rules
|
Click Here to Expand Forum to Full Width
|