Received: from qmsql.netservers.net (hpmail3.netservers.net [209.196.128.174]) by postgresql.org (Postfix) with SMTP id 4C4AB475E2D for ; Mon, 25 Feb 2002 14:17:02 -0500 (EST) Received: (qmail 62485 invoked from network); 25 Feb 2002 19:17:02 -0000 Received: from unknown (HELO AARON) (66.26.63.73) by hpmail3.netservers.net with SMTP; 25 Feb 2002 19:17:02 -0000 Message-ID: <01d001c1be30$5d0a5370$110a010a@headquarters.wcgroup.com> From: "Samuel J. Sutjiono" To: "Fernando Schapachnik" Cc: References: <016001c1be20$3d65fed0$110a010a@headquarters.wcgroup.com> <20020225155918.C65115@ns1.via-net-works.net.ar> Subject: Re: [GENERAL] Sort problem Date: Mon, 25 Feb 2002 14:12:26 -0500 MIME-Version: 1.0 Content-Type: text/plain; charset="iso-8859-1" Content-Transfer-Encoding: 8bit X-Priority: 3 X-MSMail-Priority: Normal X-Mailer: Microsoft Outlook Express 5.50.4522.1200 X-MimeOLE: Produced By Microsoft MimeOLE V5.50.4522.1200 X-Archive-Number: 200202/364 X-Sequence-Number: 6786 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" To: "Samuel J. Sutjiono" 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 >