pg.ddx.io pgsql-sql@postgresql.org mailing list archive
help / color / mirror / Atom feedRe: Conversion from Sybase ASA
3+ messages / 3 participants
[nested] [flat]
* Conversion from Sybase ASA
@ 2003-09-09 07:06 Richard Sydney-Smith <richard@ibisaustralia.com>
2003-09-09 07:06 ` Re: Conversion from Sybase ASA Viorel Dragomir <bc@vio.ro>
2003-09-09 07:17 ` Re: Conversion from Sybase ASA Ian Barwick <barwick@gmx.net>
0 siblings, 2 replies; 3+ messages in thread
From: Richard Sydney-Smith @ 2003-09-09 07:06 UTC (permalink / raw)
To: pgsql-sql
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
^ permalink raw reply [nested|flat] 3+ messages in thread
* Re: Conversion from Sybase ASA
2003-09-09 07:06 Conversion from Sybase ASA Richard Sydney-Smith <richard@ibisaustralia.com>
@ 2003-09-09 07:06 ` Viorel Dragomir <bc@vio.ro>
1 sibling, 0 replies; 3+ messages in thread
From: Viorel Dragomir @ 2003-09-09 07:06 UTC (permalink / raw)
To: Richard Sydney-Smith <richard@ibisaustralia.com>; pgsql-sql
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
^ permalink raw reply [nested|flat] 3+ messages in thread
* Re: Conversion from Sybase ASA
2003-09-09 07:06 Conversion from Sybase ASA Richard Sydney-Smith <richard@ibisaustralia.com>
@ 2003-09-09 07:17 ` Ian Barwick <barwick@gmx.net>
1 sibling, 0 replies; 3+ messages in thread
From: Ian Barwick @ 2003-09-09 07:17 UTC (permalink / raw)
To: Richard Sydney-Smith <richard@ibisaustralia.com>; pgsql-sql
On Tuesday 09 September 2003 09:06, Richard Sydney-Smith wrote:
> 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?
"CASE":
http://www.postgresql.org/docs/7.3/static/functions-conditional.html
Ian Barwick
barwick@gmx.net
^ permalink raw reply [nested|flat] 3+ messages in thread
end of thread, other threads:[~2003-09-09 07:17 UTC | newest]
Thread overview: 3+ messages (download: mbox mbox.gz follow: Atom feed)
-- links below jump to the message on this page --
2003-09-09 07:06 Conversion from Sybase ASA Richard Sydney-Smith <richard@ibisaustralia.com>
2003-09-09 07:06 ` Viorel Dragomir <bc@vio.ro>
2003-09-09 07:17 ` Ian Barwick <barwick@gmx.net>
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