pg.ddx.io  pgsql-sql@postgresql.org mailing list archive  
help / color / mirror / Atom feed
From: Samuel J. Sutjiono <ssutjiono@wc-group.com>
To: Fernando Schapachnik <fschapachnik@vianetworks.com.ar>
Cc: pgsql-sql@postgresql.org
Subject: Re: [GENERAL] Sort problem
Date: Mon, 25 Feb 2002 14:12:26 -0500
Message-ID: <01d001c1be30$5d0a5370$110a010a@headquarters.wcgroup.com> (raw)
References: <016001c1be20$3d65fed0$110a010a@headquarters.wcgroup.com>
	<20020225155918.C65115@ns1.via-net-works.net.ar>

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@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
>




view thread (9+ messages)  latest in thread

Message-ID: <01d001c1be30$5d0a5370$110a010a@headquarters.wcgroup.com>
Permalink:  ../01d001c1be30$5d0a5370$110a010a@headquarters.wcgroup.com/
Also on:    postgresql.org/message-id/01d001c1be30$5d0a5370$110a010a@headquarters.wcgroup.com

 · 

reply

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Reply to all the recipients using the --to and --cc options:
  reply via email

  To: pgsql-sql@postgresql.org
  Cc: ssutjiono@wc-group.com, fschapachnik@vianetworks.com.ar
  Subject: Re: [GENERAL] Sort problem
  In-Reply-To: <01d001c1be30$5d0a5370$110a010a@headquarters.wcgroup.com>

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

This inbox is served by DDX for PostgreSQL; see mirroring instructions
for how to clone and mirror all data and code used for this inbox