Re: [SQL] Sql ORDER BY and ASC/DESC question

2008-01-30 Thread Gregory Stark
"Tom Lane" <[EMAIL PROTECTED]> writes: > Gregory Stark <[EMAIL PROTECTED]> writes: > >> ORDER BY >> CASE ? >> WHEN 1 THEN name ASC > > Uh, no, putting the ASC/DESC decoration inside a CASE like that is not > gonna work doh! I had a feeling something was wrong but couldn't put my finger on it

Re: [SQL] Sql ORDER BY and ASC/DESC question

2008-01-30 Thread Tom Lane
Gregory Stark <[EMAIL PROTECTED]> writes: > If you're not concerned with the planner being able to find indexes to satisfy > these orderings (ie, you don't mind always doing a sort) you could do > something like: > ORDER BY > CASE ? > WHEN 1 THEN name ASC > WHEN 2 THEN name DESC > WHEN 3 THE

Re: [SQL] Sql ORDER BY and ASC/DESC question

2008-01-30 Thread Gregory Stark
"A. Kretschmer" <[EMAIL PROTECTED]> writes: > am Wed, dem 30.01.2008, um 11:35:51 +0100 mailte Jaroslav Sivy folgendes: >> 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 a

Re: [SQL] Sql ORDER BY and ASC/DESC question

2008-01-30 Thread Bart Degryse
Actually there might be assuming your function is a set returning function. This example eg works perfectly and sorts the output of the function without having to use execute. CREATE TABLE "public"."error_types" ( "id" SERIAL, "errdesc" TEXT NOT NULL, "autofix" BOOLEAN DEFAULT false NOT

Re: [SQL] Sql ORDER BY and ASC/DESC question

2008-01-30 Thread A. Kretschmer
am Wed, dem 30.01.2008, um 11:35:51 +0100 mailte Jaroslav Sivy folgendes: > 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 t

[SQL] Sql ORDER BY and ASC/DESC question

2008-01-30 Thread Jaroslav Sivy
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