Problems with to_number

From: Chrishelring <christianhelring(at)gmail(dot)com>
To: pgsql-general(at)postgresql(dot)org
Subject: Problems with to_number
Date: 2011-06-10 20:45:46
Message-ID: 1307738746972-4477251.post@n5.nabble.com
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-general

HI all,

below is the view i´ve tried to create on a table. The purpose was to do
some math on one of the columns (retning). The column is a double precision
number. The result is that the function is not recognized ("ERROR: function
to_number(double precision, unknown) does not exist"). I´m a bit uncertain
on how the syntax is, so perhaps someone could point me in the right
direction?

thanks in advance,

Christian

CREATE OR REPLACE VIEW "husnr_view" ("KOMNR", "VEJKODE", "VEJNAVN",
"HUSNUMMER", "POSTNR", "POSTNAVN", "X", "Y", "RETNING", "TSTAND", "NKLASSE")
AS
SELECT
HUSNR.KOMNR KOMNR,
HUSNR.VEJKODE VEJKODE,
HUSNR.VEJNAVN VEJNAVN,
HUSNUMMER,
HUSNR.POSTNR POSTNR,
HUSNR.POSTNAVN POSTNAVN,
HUSNR.X X,
HUSNR.Y Y,
CASE
WHEN TO_NUMBER(HUSNR.RETNING, '999g99')<20000
THEN (20000-TO_NUMBER(HUSNR.RETNING, '999g99'))/111
WHEN TO_NUMBER(HUSNR.RETNING, '999g99')>20000
THEN (40000-(TO_NUMBER(HUSNR.RETNING, '999g99')-20000))/111
END RETNING,
HUSNR.TSTAND TSTAND,
HUSNR.NKLASSE NKLASSE

FROM rk_grundkort.husnr;

--
View this message in context: http://postgresql.1045698.n5.nabble.com/Problems-with-to-number-tp4477251p4477251.html
Sent from the PostgreSQL - general mailing list archive at Nabble.com.

Responses

Browse pgsql-general by date

  From Date Subject
Next Message Thomas Kellerer 2011-06-10 21:08:18 Re: Problems with to_number
Previous Message akp geek 2011-06-10 20:13:34 Re: setting up streaming error. Please help