To read the article online, visit http://www.4GuysFromRolla.com/webtech/092099-1.shtml

Parameterized ORDER BY using Oracle


Note from Webmaster (Scott Mitchell): The below text is quoted from an email I received on 9/16/99!


I think Stump the SQL Guru is great! The question about parameterized ORDER BY's especially hit home for me. Unfortunately, your example only works in SQL Server. Below is a sample that works in Oracle, so you can pass it on in case you have any Oracle users out there. Keep it up!

Marc

SELECT FirstName, LastName, DECODE ( ColumnNumberAsAnInteger ,1 ,FirstName ,2 ,LastName ,1 ) AS SortCol FROM Emp ORDER BY SortCol

Happy Programming!


Article Information
Article Title: Parameterized ORDER BY using Oracle
Article Author: Marc B.
Published Date: Monday, September 20, 1999
Article URL: http://www.4GuysFromRolla.com/webtech/092099-1.shtml


Copyright 2017 QuinStreet Inc. All Rights Reserved.
Legal Notices, Licensing, Permissions, Privacy Policy.
Advertise | Newsletters | E-mail Offers