Re: converting varchar to integer - Mailing list pgsql-sql

From Halley Pacheco de Oliveira
Subject Re: converting varchar to integer
Date
Msg-id 20050817104605.76269.qmail@web52703.mail.yahoo.com
Whole thread Raw
In response to converting varchar to integer  (tv@fuzzy.cz)
List pgsql-sql
Using CASE to avoid '':

CREATE TABLE test (number TEXT);
INSERT INTO test VALUES('123');
INSERT INTO test VALUES('a123b');
INSERT INTO test VALUES('');
teste=> SELECT CASE number WHEN '' THEN NULL ELSE to_number(number,'999999999999990') END AS
number FROM test;;number
--------   123   123

(3 lines)


__________________________________________________
Converse com seus amigos em tempo real com o Yahoo! Messenger 
http://br.download.yahoo.com/messenger/ 


pgsql-sql by date:

Previous
From: Kretschmer Andreas
Date:
Subject: Re: [despammed] converting varchar to integer
Next
From: Frank Bax
Date:
Subject: Re: [despammed] converting varchar to integer