Using Parameters in Order By Clause in PL - SQL

Tutorials Shared by the Internet Community


  Top Tutorials     New Tutorials     Submit     Login     Register  

Using Parameters in Order By Clause in PL - SQL

Today I was working on a data table, output in HTML generated by PL/SQL
  • Total Hits: 29013

  • Average Rating :
    URL RatingURL RatingURL RatingURL RatingURL Rating


  • Total Votes: 155 votes

  • Category: Oracle/Oracle Misc

  • Submitted on: 2008-04-15 01:56:23

  • Submitted By: Shekhar

  • Set as Favorite


Basically I have a procedure which takes a parameter (p_sort_by) and establishes which column to sort by based on this parameter. It does this using the DECODE function, which has similar functionality to IF-THEN-ELSE statements. I could have alternatively used CASE statements here, which are easier to understand, but they are not supported in older versions of Oracle.    More detail...

Rating Detail

 Stars  Percentage  Total Vote
 One star  Vote LeftVote MiddleVote Right 36.77%  57
 Two starsTwo star  Vote LeftVote MiddleVote Right 10.97%  17
 Three starsThree starsThree stars  Vote LeftVote MiddleVote Right 12.26%  19
 Four starsFour starsFour starsFour stars  Vote LeftVote MiddleVote Right 11.61%  18
 Five starsFive starsFive starsFive starsFive stars  Vote LeftVote MiddleVote Right 28.39%  44

Caste Your Vote

 Rating  Selection  Guidelines
 Poor:     Very disappointing, useless.
 Fair:     Below average, disappointing but not useless.
 Good:     About average in its class.
 Very Good:     Above average for its category.
 Excellent:     One of the best Tutorials in its category.