Re: [GENERAL] Sort problem

From: "Samuel J(dot) Sutjiono" <ssutjiono(at)wc-group(dot)com>
To: "Fernando Schapachnik" <fschapachnik(at)vianetworks(dot)com(dot)ar>
Cc: <pgsql-sql(at)postgresql(dot)org>
Subject: Re: [GENERAL] Sort problem
Date: 2002-02-25 19:12:26
Message-ID: 01d001c1be30$5d0a5370$110a010a@headquarters.wcgroup.com
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-general pgsql-sql

Fernando,

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

IF (SortOrder = ''price'') Then
BEGIN
For 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(at)vianetworks(dot)com(dot)ar>
To: "Samuel J. Sutjiono" <ssutjiono(at)wc-group(dot)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(at)vianetworks(dot)com(dot)ar
> Tel.: (54-11) 4323-3381
>

In response to

  • Sort problem at 2002-02-25 17:17:01 from Samuel J. Sutjiono

Browse pgsql-general by date

  From Date Subject
Next Message Bruce Momjian 2002-02-25 19:46:37 Re: [SQL] Sort problem
Previous Message Eric Webber 2002-02-25 18:41:03 LXP, APACHE auth_module with html form, & mod_auth_pg questions

Browse pgsql-sql by date

  From Date Subject
Next Message Peter Eisentraut 2002-02-25 19:15:41 Re: About referential integrity.
Previous Message Jan Wieck 2002-02-25 19:09:28 Re: PLPGSQL func. defn. for returning resultset?