Sql ORDER BY and ASC/DESC question

Поиск
Список
Период
Сортировка
Искать
От
Jaroslav Sivy
Тема
Sql ORDER BY and ASC/DESC question
Дата
Msg-id
aa457f86948348248e93c6fc38b4b1f6@pobox.sk
Список
Дерево обсуждения
Sql ORDER BY and ASC/DESC question "Jaroslav Sivy" <yarex@pobox.sk>
Re: Sql ORDER BY and ASC/DESC question "A. Kretschmer" <andreas.kretschmer@schollglas.com>
Re: Sql ORDER BY and ASC/DESC question "Bart Degryse" <Bart.Degryse@indicator.be>
Re: Sql ORDER BY and ASC/DESC question Gregory Stark <stark@enterprisedb.com>
Re: Sql ORDER BY and ASC/DESC question Tom Lane <tgl@sss.pgh.pa.us>
Re: Sql ORDER BY and ASC/DESC question Gregory Stark <stark@enterprisedb.com>
Double query PostgreSQL Admin <postgres@productivitymedia.com>
Re: Double query "D'Arcy J.M. Cain" <darcy@druid.net>
Hello everyone,

I have following problem: am using pl/sql functions to trigger some sql code and i need to pass ORDER_BY column name and ASC/DESC sorting order as an input parameters into that function
and order the result based on these input parameters.

The problem is, that the only way is to create query as "string" and then execute it as "string".

Is there any other way around how to avoid that "string query"?

(i don't want to use IFs either, because 5 columns x 2 sorting orders would require 10 IFfed queries with different column/sorting order combination)


If it's not possible, could anyone implement this feature into one of future versions? I think that it would be quite handy to have something like that.

Thank you for your responses.
-------------------
Menu.sk - Denne aktualizovany zoznam obedovych menu a restauracii s presnou lokalizaciou. 

В списке pgsql-sql по дате отправления
От: Steve Midgley
Дата:
От: A. Kretschmer
Дата:
FAQ