Re: SQL state: 22P02

From: Rodrigo De León <rdeleonp(at)gmail(dot)com>
To: "Franklin Haut" <franklin(dot)haut(at)gmail(dot)com>
Cc: pgsql-sql(at)postgresql(dot)org
Subject: Re: SQL state: 22P02
Date: 2007-11-22 16:06:25
Message-ID: a55915760711220806gb77d638wc68cb853e8c3013@mail.gmail.com
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-sql

On Nov 22, 2007 11:24 AM, Franklin Haut <franklin(dot)haut(at)gmail(dot)com> wrote:
> num return
> ---- ------
> 0 0
> null false
> 12 12
> a false
> 12ab false
>
> it´s possible get these results ?

Try:

SELECT
NUM
, CASE
WHEN TRIM(NUM) ~ '^[0-9]+(.[0-9]+){0,1}$'
THEN NUM
ELSE 'false'
END AS RETURN
FROM TEST;

In response to

Browse pgsql-sql by date

  From Date Subject
Next Message Franklin Haut 2007-11-22 16:24:36 SQL state: 22P02
Previous Message Bart Degryse 2007-11-22 14:11:46 Re: dynmic column names inside trigger?