RE: sort order on VIEWs ?

From: Michael Dinh <mdinh_at_XIFIN.Com>
Date: Thu, 21 Apr 2011 14:26:36 -0700
Message-ID: <D29F9902E534D5478F2E83FD6A44B3063A8F663384_at_mail02.mba.xifin.com>



Separate data from presentation.

Why would you type the same SQL a dozen time a day?

IF you execute that SQL that much, then wouldn't it make sense to save it to a SQL script?

You still have to type - Select * from my_view

And are you happy doing that 12x a day?

Michael Dinh

NOTICE OF CONFIDENTIALITY - This material is intended for the use of the individual or entity to which it is addressed, and may contain information that is privileged, confidential and exempt from disclosure under applicable laws. BE FURTHER ADVISED THAT THIS EMAIL MAY CONTAIN PROTECTED HEALTH INFORMATION (PHI). BY ACCEPTING THIS MESSAGE, YOU ACKNOWLEDGE THE FOREGOING, AND AGREE AS FOLLOWS: YOU AGREE TO NOT DISCLOSE TO ANY THIRD PARTY ANY PHI CONTAINED HEREIN, EXCEPT AS EXPRESSLY PERMITTED AND ONLY TO THE EXTENT NECESSARY TO PERFORM YOUR OBLIGATIONS RELATING TO THE RECEIPT OF THIS MESSAGE. If the reader of this email (and attachments) is not the intended recipient, you are hereby notified that any dissemination, distribution or copying of this communication is strictly prohibited. Please notify the sender of the error and delete the e-mail you received. Thank you. From: oracle-l-bounce_at_freelists.org [mailto:oracle-l-bounce_at_freelists.org] On Behalf Of Michael Moore Sent: Wednesday, April 20, 2011 11:45 AM To: Lange, Kevin G
Cc: oracle-l_at_freelists.org
Subject: Re: sort order on VIEWs ?

I am really trying to make a case to somebody else that he should not do it. However, there is the matter of convenience.

Select * from my_view order by cust_num,billing_cycle_period,invoice_id,line_id,unit_price;

Now if I have to type that out a dozen times a day, and that is always the sort order (i.e. nothing else really makes any sense) then it might be convenient to have the sort order on the view.

That's the only counter argument I could come up with.

Regards,

Mike

On Wed, Apr 20, 2011 at 11:39 AM, Lange, Kevin G <kevin.lange_at_ppoone.com<mailto:kevin.lange_at_ppoone.com>> wrote: Yea, I was gonna ask you the question ........ why would you include an order by in a view ?



From: Michael Moore [mailto:michaeljmoore_at_gmail.com<mailto:michaeljmoore_at_gmail.com>] Sent: Wednesday, April 20, 2011 1:38 PM
To: Lange, Kevin G
Cc: oracle-l_at_freelists.org<mailto:oracle-l_at_freelists.org> Subject: Re: sort order on VIEWs ?
Thanks kevin.
Since asking the question I did some digging.

http://en.wikipedia.org/wiki/View_(database) 4th paragraph

The take-away is that you can do it in Oracle, but it's not standard and probably not a good idea.

Regards,
Mike

On Wed, Apr 20, 2011 at 11:34 AM, Lange, Kevin G <kevin.lange_at_ppoone.com<mailto:kevin.lange_at_ppoone.com>> wrote: Not sure about a Guarantee, but, in my tests, as long as I did not include an order by on the query contrary to the order by on the view, I got my data in the order of the views order by.

Of course, it was a small sampling of data.



From: oracle-l-bounce_at_freelists.org<mailto:oracle-l-bounce_at_freelists.org> [mailto:oracle-l-bounce_at_freelists.org<mailto:oracle-l-bounce_at_freelists.org>] On Behalf Of Michael Moore Sent: Wednesday, April 20, 2011 1:20 PM
To: oracle-l_at_freelists.org<mailto:oracle-l_at_freelists.org> Subject: sort order on VIEWs ?
If a VIEW has an ORDER BY clause, am I guaranteed to get that sort order when I use the VIEW (provided of course that I don't specify a different sort order)?

Regards,
Mike

This e-mail, including attachments, may include confidential and/or proprietary information, and may be used only by the person or entity to which it is addressed. If the reader of this e-mail is not the intended recipient or his or her authorized agent, the reader is hereby notified that any dissemination, distribution or copying of this e-mail is prohibited. If you have received this e-mail in error, please notify the sender by replying to this message and delete this e-mail immediately.

This e-mail, including attachments, may include confidential and/or proprietary information, and may be used only by the person or entity to which it is addressed. If the reader of this e-mail is not the intended recipient or his or her authorized agent, the reader is hereby notified that any dissemination, distribution or copying of this e-mail is prohibited. If you have received this e-mail in error, please notify the sender by replying to this message and delete this e-mail immediately.

--
http://www.freelists.org/webpage/oracle-l
Received on Thu Apr 21 2011 - 16:26:36 CDT

Original text of this message