Hello, I have a procedure which takes few arguments. The arguments must affect expressions set of "order by" clause. For instance in one case ordering must be performed by 1st, 2nd (desc) and 3rd fields but in another by 3rd, 1st and 2nd fields. Is there a way to manage it without using dynamic queries (execute '...') and code duplicating? -- Regards, Sergey Konoplev ---------------------------(end of broadcast)--------------------------- TIP 4: Have you searched our list archives? http://archives.postgresql.org/