To read the article online, visit

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!


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:

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