1 Apr 2003 11:53
Re: create view with numeric data
Thomas Kellerer <spam_eater <at> gmx.net>
2003-04-01 09:53:45 GMT
2003-04-01 09:53:45 GMT
Haven't tried it, but if you casted the result of the sum to
numeric(9,2)? Btw: does the ELSE '0' really work? It seems a bit strange
to put a string into a SUM...
cast ( sum(CASE WHEN month='01' THEN budgetvalue ELSE 0 END) as
numeric(9,2)) AS january
Thomas
cio198 schrieb:
> Hello,
>
> i've created this table
>
> CREATE TABLE "budget" (
> "year" character varying NOT NULL,
> "month" character varying NOT NULL,
> "accountno" character varying NOT NULL,
> "costid" character varying NOT NULL,
> "valutacode" character varying,
> "budgetvalue" numeric(9,2) DEFAULT '0',
> "deptname" character varying,
> Constraint "budget_pkey" Primary Key ("year", "month",
> "accountno", "costid")
> );
>
> And I want to create the a view using query bellow.
> The problem is the numeric data in the view isn't limited to
> numeric(9,2) instead it become numeric(65535, 65531).
> Is there any way i can restrict it to numeric (9,2)
(Continue reading)
>
Regards,
Oleg
_____________________________________________________________
Oleg Bartunov, sci.researcher, hostmaster of AstroNet,
Sternberg Astronomical Institute, Moscow University (Russia)
Internet: oleg <at> sai.msu.su,
. Before 7.3, drop the index; as of 7.3 you're
supposed to drop the constraint instead. (No harm in trying the wrong
one, it just won't let you do it.)
Looking at the output of psql's "\d b_prestamo" would be a good idea to
verify the spelling of the index and/or constraint name.
regards, tom lane
---------------------------(end of broadcast)---------------------------
TIP 4: Don't 'kill -9' the postmaster
RSS Feed