Re: [GENERAL] Extract only numbers from a varchar column

2008-05-10 Thread Gerald Quimpo
On Tuesday 06 May 2008 07:09:56 Leandro Casadei wrote: > I need to extract only the first occurence of numbers from a column that > is varchar. > abc200xx -> 200 > 340ppsdd -> 340 > 150ytyty555 -> 150 tiger=> select substring('abc200xx300ff','[0-9]+'); substring --- 200 (1 row) Time:

Re: [GENERAL] Extract only numbers from a varchar column

2008-05-06 Thread Leandro Casadei
-- Forwarded message -- From: Leandro Casadei <[EMAIL PROTECTED]> Date: May 5, 2008 2:08 PM Subject: Extract only numbers from a varchar column To: pgsql-general@postgresql.org I need to extract only the first occurence of numbers from a column that is varchar. Here are a few exa

[GENERAL] Extract only numbers from a varchar column

2008-05-06 Thread Leandro Casadei
I need to extract only the first occurence of numbers from a column that is varchar. Here are a few examples of what I need to do: abc200xx -> 200 340ppsdd -> 340 150ytyty555 -> 150 Can this be done by a simple query or do I need to use a cursor? Thanks