Re: [GENERAL] Sort problem - Mailing list pgsql-sql

From Samuel J. Sutjiono
Subject Re: [GENERAL] Sort problem
Date
Msg-id 01d001c1be30$5d0a5370$110a010a@headquarters.wcgroup.com
Whole thread Raw
In response to Sort problem  ("Samuel J. Sutjiono" <ssutjiono@wc-group.com>)
List pgsql-sql
Fernando,

My apology. Actually I posted the wrong problem. Here is my problem:

IF (SortOrder = ''price'') Then
BEGINFor rec_set IN  SELECT * from Catalog where ((VendorName ~* SearchString)  ORDER BY CASE WHEN SortOrder =
''store''Then VendorName                                WHEN SortOrder = ''category'' Then
 
ProductCategory Else Price END

Here is the error message:
ERROR:  CASE types "numeric" and "varchar" not matched.

By the way, do you know how to do a variable (that contains 'attribute name'
instead of 'attribute value') substitution. For instance, if the attribute
name 'Price' is passed to the sort parameter ($1) so I can just do ORDER BY
$1 instead of doing case statement.

Thanks so much for your help.

----- Original Message -----
From: "Fernando Schapachnik" <fschapachnik@vianetworks.com.ar>
To: "Samuel J. Sutjiono" <ssutjiono@wc-group.com>
Sent: Monday, February 25, 2002 1:59 PM
Subject: Re: [GENERAL] Sort problem


> Maybe someone can help you if you post your query and the error
> message. Is like going to the doctor: you don't has claim: "it
> hurts".
>
> Good luck
>
> En un mensaje anterior, Samuel J. Sutjiono escribió:
> > I was trying to do the following sort (two attributes with different
types), but I kept on getting errors.
> >
> > ORDER BY Price (data type - decimal), ProductName (data type - varchar)
> >
> > Thanks for any help.
> >
> >
>
>
>
> Fernando P. Schapachnik
> Gerente de tecnología de red
> y sistemas de información
> VIA NET.WORKS ARGENTINA S.A.
> fschapachnik@vianetworks.com.ar
> Tel.: (54-11) 4323-3381
>



pgsql-sql by date:

Previous
From: Peter Eisentraut
Date:
Subject: Re: About referential integrity.
Next
From: Bruce Momjian
Date:
Subject: Re: Sort problem