Re: Using right() in a view

From: Bosco Rama <postgres(at)boscorama(dot)com>
To: Chrishelring <christianhelring(at)gmail(dot)com>
Cc: pgsql-general(at)postgresql(dot)org
Subject: Re: Using right() in a view
Date: 2011-05-23 16:37:22
Message-ID: 4DDA8D42.4000003@boscorama.com
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-general

Chrishelring wrote:
>
> CREATE OR REPLACE VIEW test AS
> SELECT
> right(cast('000' as text) || cast(road_number as text), 4) AS GEO_ADRESSE
>
> FROM rk_ois.bbrbygning
> WHERE ejerlav <> 0
>
> to ensure that the road_number would be a fixed size (four digitis).
> Unfortunately this doesn't work.

Try using:
select to_char(road_number, 'FM0000') as GEO_ADRESSE

HTH

Bosco.

In response to

Browse pgsql-general by date

  From Date Subject
Next Message Bosco Rama 2011-05-23 18:27:42 Re: Postgres 8.3.5 - ECPG and the use of descriptors and cursors in multi-threaded programs
Previous Message Chrishelring 2011-05-23 14:10:36 Using right() in a view