Subject | How to multiply a time value and a numeric value. |
---|---|
Author | Çağatay Tengiz |
Post date | 2001-10-03T19:49:14Z |
Hi to all,
In my table I'm trying to calculate the cost of a person by multiplying
person's hour rate by working time.
So I got a hourly rate value a numeric field and working time a time field.
When I try to multiply these I get an error.
I am doing this in a trigger. And my trigger looks like :
ALTER TRIGGER SURE_YAZ_INS
BEFORE INSERT
POSITION 0
AS
declare variable tutar double precision;
BEGIN
select percost from personel where kod = new.kod_per into :tutar;
new.cost = :tutar * cast(new.sure as numeric(18, 3));
END
thanks
best regards
~-~-~-~-~-~-~-~-~-~-~-~-~-~-~-~-~-~-~-~-
Cagatay Tengiz
cagatay.tengiz@...
Tengiz Engineering & Consultancy
www.tengiz.net
Phone : +90 232 388 07 01
Fax : +90 232 373 42 63
Kazim Karabekir Cad. No:47/B 35040
Bornova - Izmir / TURKEY
~-~-~-~-~-~-~-~-~-~-~-~-~-~-~-~-~-~-~-~-
_________________________________________________________
Do You Yahoo!?
Get your free @... address at http://mail.yahoo.com
In my table I'm trying to calculate the cost of a person by multiplying
person's hour rate by working time.
So I got a hourly rate value a numeric field and working time a time field.
When I try to multiply these I get an error.
I am doing this in a trigger. And my trigger looks like :
ALTER TRIGGER SURE_YAZ_INS
BEFORE INSERT
POSITION 0
AS
declare variable tutar double precision;
BEGIN
select percost from personel where kod = new.kod_per into :tutar;
new.cost = :tutar * cast(new.sure as numeric(18, 3));
END
thanks
best regards
~-~-~-~-~-~-~-~-~-~-~-~-~-~-~-~-~-~-~-~-
Cagatay Tengiz
cagatay.tengiz@...
Tengiz Engineering & Consultancy
www.tengiz.net
Phone : +90 232 388 07 01
Fax : +90 232 373 42 63
Kazim Karabekir Cad. No:47/B 35040
Bornova - Izmir / TURKEY
~-~-~-~-~-~-~-~-~-~-~-~-~-~-~-~-~-~-~-~-
_________________________________________________________
Do You Yahoo!?
Get your free @... address at http://mail.yahoo.com