Subject | Re: [ib-support] Please Help - Calculate fields(urgent) |
---|---|
Author | Paul Reeves |
Post date | 2002-09-21T08:40:59Z |
news.clix.pt wrote:
====
show sql dialect;
create table test_comp(
PRECOTOTAL NUMERIC(18,4),
CAMBIO NUMERIC(18,8) NOT NULL,
QTD INTEGER NOT NULL,
PREUNIMOE COMPUTED BY ((PRECOTOTAL/QTD)),
PREUNIEUR COMPUTED BY ((PRECOTOTAL*CAMBIO/QTD ))
);
insert into test_comp (PRECOTOTAL, CAMBIO, QTD)
values (157809.0000, 1.00000000, 1077 );
select * from test_comp;
====
yeilds this result:
PRECOTOTAL CAMBIO QTD PREUNIMOE PREUNIEUR
=========== =========== ======== =============== =================
157809.0000 1.00000000 1077 146.5264 146.526462395543
Fundamentally, I'm happy with this result, so I suspect that your error
is outside the engine. What software are you using with Firebird?
Paul
--
Paul Reeves
http://www.ibphoenix.com
Supporting users of Firebird and InterBase
> Thanks for the anwserOK, here is what I have tried with ISQL:
> i'm using dialect 3
>
>
> my table is
> CREATE TABLE COMPRAS (
> ID INTEGER NOT NULL,
> REF VARCHAR(15),
> CODEM VARCHAR(5) NOT NULL,
> QTD INTEGER NOT NULL,
> DATA DATE,
> QTDVEN NUMERIC(18,4) NOT NULL,
> CAMBIO NUMERIC(18,8) NOT NULL,
> PRECOTOTAL NUMERIC(18,4),
> INDISPONIVEIS SMALLINT NOT NULL,
> CODMOE VARCHAR(3) NOT NULL,
> PREUNIMOE COMPUTED BY ((PRECOTOTAL/QTD)),
> PREUNIEUR COMPUTED BY ((PRECOTOTAL*CAMBIO/QTD ));
>
>
> PRECOTOTAL=157809.0000
> CAMBIO=1.00000000
> QTD=1077
>
> PREUNIMOE is OK
> PREUNIEUR is not
>
>
> Any comment?
>
====
show sql dialect;
create table test_comp(
PRECOTOTAL NUMERIC(18,4),
CAMBIO NUMERIC(18,8) NOT NULL,
QTD INTEGER NOT NULL,
PREUNIMOE COMPUTED BY ((PRECOTOTAL/QTD)),
PREUNIEUR COMPUTED BY ((PRECOTOTAL*CAMBIO/QTD ))
);
insert into test_comp (PRECOTOTAL, CAMBIO, QTD)
values (157809.0000, 1.00000000, 1077 );
select * from test_comp;
====
yeilds this result:
PRECOTOTAL CAMBIO QTD PREUNIMOE PREUNIEUR
=========== =========== ======== =============== =================
157809.0000 1.00000000 1077 146.5264 146.526462395543
Fundamentally, I'm happy with this result, so I suspect that your error
is outside the engine. What software are you using with Firebird?
Paul
--
Paul Reeves
http://www.ibphoenix.com
Supporting users of Firebird and InterBase