Hi,
following function doesn't work with numeric type, when I change type
of 'total_no_vat' to anything else incl. float it works OK. What am I
doing wrong? Thanks for your help.
- Robert
CREATE TABLE deb_invoice_line_table (
qty NUMERIC(13,2),
unit_price NUMERIC(13,2),
total_no_vat NUMERIC(13,2),
-- ...
)
CREATE FUNCTION deb_invoice_line_complete() RETURNS OPAQUE AS 'BEGIN
NEW.total_no_vat := 5.2;
RETURN NEW;
END;' LANGUAGE 'plpgsql';
CREATE TRIGGER deb_invoice_line_trigger
BEFORE INSERT OR UPDATE
ON deb_invoice_line_table
FOR EACH ROW EXECUTE PROCEDURE deb_invoice_line_complete();
INSERT INTO deb_invoice_line_table (qty,unit_price) VALUES (3,33);
ERROR: overflow on numeric ABS(value) >= 10^0 for field with precision
0 scale 2