Re: Newbie question about casting literals - oracle/postgres

From: Dianne Yumul <dianne(at)wellsgaming(dot)com>
To: "Naeem Bari" <naeem(dot)bari(at)agilissystems(dot)com>
Cc: pgsql-general(at)postgresql(dot)org
Subject: Re: Newbie question about casting literals - oracle/postgres
Date: 2004-10-27 16:22:25
Message-ID: 634BA259-2834-11D9-A0F7-000A95D7EFFE@wellsgaming.com
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-general

hi,

I think it works for me. what version of postgres do you have? maybe
you just need to upgrade : )

test=# select cust_id, 'TEST' as test, cust_address from customers;
cust_id | test | cust_address
------------+------+----------------------
1000000001 | TEST | 200 Maple Lane
1000000002 | TEST | 333 South Lake Drive
1000000003 | TEST | 1 Sunny Place
1000000004 | TEST | 829 Riverside Drive
1000000005 | TEST | 4545 53rd Street
1000000006 | TEST |
(6 rows)

test=# select version();
version
------------------------------------------------------------------------
--------------------------------------------------------
PostgreSQL 7.3.7 on powerpc-unknown-linux-gnu, compiled by GCC gcc
(GCC) 3.2.3 20030422 (Gentoo Linux 1.4 3.2.3-r4, propolice)
(1 row)

hth,

dianne

On Oct 26, 2004, at 6:24 PM, Naeem Bari wrote:

> Ok,
>
>  
>
> I have a query that runs fine in oracle:
>
>  
>
>    select driver_id, 'GREEN' as color, pos_date, pos_lat, pos_lon
>
>    from driver_pos
>
>    where driver_id = 1
>
>    order by pos_date
>
>  
>
> The only way this works in postgres is by casting ‘GREEN’ to text
> using ‘GREEN’::text
>
>  
>
> The problem is then this does not work with oracle. Since my software
> has to support both databases, I am left in a bit of a bind. Any ideas
> on how to make postgres accept ‘GREEN’ as text without my having to
> spell it out by casting?
>
>  
>
> Thanks!
>
> naeem

In response to

Browse pgsql-general by date

  From Date Subject
Next Message Michael Fuhr 2004-10-27 17:01:39 Re: Reasoning behind process instead of thread based arch?
Previous Message Scott Marlowe 2004-10-27 16:21:27 Re: Reasoning behind process instead of thread based