pg.ddx.io  pgsql-sql@postgresql.org mailing list archive  
help / color / mirror / Atom feed
From: Rodrigo De León <rdeleonp@gmail.com>
To: Franklin Haut <franklin.haut@gmail.com>
Cc: pgsql-sql@postgresql.org
Subject: Re: SQL state: 22P02
Date: Thu, 22 Nov 2007 11:06:25 -0500
Message-ID: <a55915760711220806gb77d638wc68cb853e8c3013@mail.gmail.com> (raw)
In-Reply-To: <4745AD44.1@gmail.com>
References: <4745AD44.1@gmail.com>

On Nov 22, 2007 11:24 AM, Franklin Haut <franklin.haut@gmail.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;


view thread (2+ messages)  latest in thread

Message-ID: <a55915760711220806gb77d638wc68cb853e8c3013@mail.gmail.com>
Permalink:  ../a55915760711220806gb77d638wc68cb853e8c3013@mail.gmail.com/
Also on:    postgresql.org/message-id/a55915760711220806gb77d638wc68cb853e8c3013@mail.gmail.com

 · 

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: rdeleonp@gmail.com, franklin.haut@gmail.com
  Subject: Re: SQL state: 22P02
  In-Reply-To: <a55915760711220806gb77d638wc68cb853e8c3013@mail.gmail.com>

* 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