X-Original-To: pgsql-sql-postgresql.org@localhost.postgresql.org Received: from localhost (unknown [64.117.224.130]) by svr1.postgresql.org (Postfix) with ESMTP id 658AAD1B4E9 for ; Tue, 9 Sep 2003 07:09:43 +0000 (GMT) Received: from svr1.postgresql.org ([64.117.224.193]) by localhost (neptune.hub.org [64.117.224.130]) (amavisd-new, port 10024) with ESMTP id 36957-06 for ; Tue, 9 Sep 2003 04:09:12 -0300 (ADT) Received: from mail1.dr.myx.net (mail1.dr.myx.net [217.10.193.161]) by svr1.postgresql.org (Postfix) with ESMTP id 95D3AD1B4F3 for ; Tue, 9 Sep 2003 04:09:10 -0300 (ADT) Received: from workstation24 (unknown [81.12.137.146]) by mail1.dr.myx.net (mydomain.myx.net) with ESMTP id 7A1FD300841; Tue, 9 Sep 2003 10:09:07 +0300 (EEST) Message-ID: <005701c376a0$ea9b5840$0600a8c0@fix.ro> From: "Viorel Dragomir" To: "Richard Sydney-Smith" , References: <001001c376a0$ee48a8d0$f06832d2@athlon2000> Subject: Re: Conversion from Sybase ASA Date: Tue, 9 Sep 2003 10:06:36 +0300 MIME-Version: 1.0 Content-Type: multipart/alternative; boundary="----=_NextPart_000_0054_01C376BA.0DD03790" X-Priority: 3 X-MSMail-Priority: Normal X-Mailer: Microsoft Outlook Express 6.00.2800.1158 X-MimeOLE: Produced By Microsoft MimeOLE V6.00.2800.1165 X-Virus-Scanned: by amavisd-new at postgresql.org X-Archive-Number: 200309/58 X-Sequence-Number: 15036 This is a multi-part message in MIME format. ------=_NextPart_000_0054_01C376BA.0DD03790 Content-Type: text/plain; charset="iso-8859-1" Content-Transfer-Encoding: quoted-printable select 'T' as src,(if tbon is null or tbon < '1900/12/12' or tbon > '1900/9= /30' then 'U' else 'P' endif) as pres from ftrans select 'T' as src,(CASE WHEN tbon is null or tbon < '1900/12/12' or tbon > = '1900/9/30' THEN 'U' ELSE 'P' END) as pres from ftrans I think it works in Oracle too :) Pay attention at tbon < '1900/12/12'. Try to use conversion on date formats= like to_date() or to_timestamp(). Good luck ----- Original Message -----=20 From: Richard Sydney-Smith=20 To: pgsql-sql@postgresql.org=20 Sent: Tuesday, September 09, 2003 10:06 AM Subject: [SQL] Conversion from Sybase ASA In sybase I can use the following syntax: select 'T' as src,(if tbon is null or tbon < '1900/12/12' or tbon > '1900= /9/30' then 'U' else 'P' endif) as pres from ftrans this returns two columns: src =3D 'T' and pres which has either the value= 'U' or 'P' how would I express this in postgresql? thanks Richard ------=_NextPart_000_0054_01C376BA.0DD03790 Content-Type: text/html; charset="iso-8859-1" Content-Transfer-Encoding: quoted-printable
select 'T' = as src,(if tbon is null or tbon < '1900/12/12' or tbon > '1900/9/30' then 'U' else=20 'P' endif) as pres from ftrans
 
select 'T' as= src,(CASE=20 WHEN tbon is null=20 or tbon < '1900/12/12' or tbon > '1900/9/30' THEN  'U' ELSE  '= P' END)=20 as pres from=20 ftrans
 
I think it works in Oracle too :)
Pay attention at tbon < '1900/12/12'. T= ry=20 to use conversion on date formats like to_date() or=20 to_timestamp().
 
Good luck
----- Original Message -----
Fro= m:=20 Richard Sydney-Smith
To: pgsql-sql@postgresql.org
Sent: Tuesday, September 09, 2003 = 10:06=20 AM
Subject: [SQL] Conversion from Syb= ase=20 ASA

In sybase I can use the following=20 syntax:
 

select 'T' as src,(if tbon is null or tbon < '1900/12/12' or tbon > '1900/9/30' <= /FONT>then 'U' else 'P' endif) as pres from=20 ftrans

this returns two columns: src =3D 'T' and pres which ha= s either=20 the value 'U' or 'P'

how would I express this in postgresql?

thanks

Richard

------=_NextPart_000_0054_01C376BA.0DD03790--