pg.ddx.io  pgsql-sql@postgresql.org mailing list archive  
help / color / mirror / Atom feed
From: Viorel Dragomir <bc@vio.ro>
To: Richard Sydney-Smith <richard@ibisaustralia.com>
To: pgsql-sql@postgresql.org
Subject: Re: Conversion from Sybase ASA
Date: Tue, 9 Sep 2003 10:06:36 +0300
Message-ID: <005701c376a0$ea9b5840$0600a8c0@fix.ro> (raw)
References: <001001c376a0$ee48a8d0$f06832d2@athlon2000>

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 ----- 
  From: Richard Sydney-Smith 
  To: pgsql-sql@postgresql.org 
  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 = 'T' and pres which has either the value 'U' or 'P'

  how would I express this in postgresql?

  thanks

  Richard

view thread (3+ messages)  latest in thread

Message-ID: <005701c376a0$ea9b5840$0600a8c0@fix.ro>
Permalink:  ../005701c376a0$ea9b5840$0600a8c0@fix.ro/
Also on:    postgresql.org/message-id/005701c376a0$ea9b5840$0600a8c0@fix.ro

 · 

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: bc@vio.ro, richard@ibisaustralia.com
  Subject: Re: Conversion from Sybase ASA
  In-Reply-To: <005701c376a0$ea9b5840$0600a8c0@fix.ro>

* 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