novnov escribió: > > While a hard coded order by clause works; passing the order by as a param is > ignored as I've implemented below. The order by value is being passed as > expected (tested by outputing the value in a column).
It doesn't because the value is expanded as a constant, therefore all rows have the same value and the sort is a no-op. Try using EXECUTE (although I admit I don't know if you are able to do an OPEN CURSOR with EXECUTE) -- Alvaro Herrera http://www.amazon.com/gp/registry/CTMLCN8V17R4 Bob [Floyd] used to say that he was planning to get a Ph.D. by the "green stamp method," namely by saving envelopes addressed to him as 'Dr. Floyd'. After collecting 500 such letters, he mused, a university somewhere in Arizona would probably grant him a degree. (Don Knuth) ---------------------------(end of broadcast)--------------------------- TIP 4: Have you searched our list archives? http://archives.postgresql.org/