| From: | Carlo Vitolo <carlino(at)ilrspa(dot)com> |
|---|---|
| To: | pgsql-sql(at)postgresql(dot)org |
| Subject: | Problem with function & trigger |
| Date: | 2001-07-07 11:05:59 |
| Message-ID: | 3B46ED17.9F3EACA4@ilrspa.com |
| Views: | Whole Thread | Raw Message | Download mbox | Resend email |
| Thread: | |
| Lists: | pgsql-sql |
This does not work. The error is ERROR: pg_atoi: error in "12.00": can't
parse ".00"
CREATE FUNCTION "togliscar" () RETURNS opaque AS 'BEGIN
UPDATE magazzino SET quantita = (SELECT quantita FROM magazzino WHERE
descrizione = NEW.descrizione )
- NEW.quantita WHERE descrizione = NEW.descrizione;
RETURN NEW;
END;
' LANGUAGE 'plpgsql';
CREATE TRIGGER "togliscarico" BEFORE INSERT ON "scarico" FOR EACH ROW
EXECUTE PROCEDURE
"togliscar" ();
This works.
CREATE FUNCTION "delscar" () RETURNS opaque AS 'BEGIN
UPDATE magazzino SET quantita = (SELECT quantita FROM magazzino WHERE
descrizione = OLD.descrizione )
+ OLD.quantita WHERE descrizione = OLD.descrizione;
RETURN OLD;
END;
' LANGUAGE 'plpgsql';
CREATE TRIGGER "delscarico" BEFORE DELETE ON "scarico" FOR EACH ROW
EXECUTE PROCEDURE
"delscar" ();
The field quantita is numeric(10,2).
Both functions works if quantita is integer.
Any hint?
Bye!
| From | Date | Subject | |
|---|---|---|---|
| Next Message | Richard Huxton | 2001-07-07 11:21:32 | Re: Is function atomic? |
| Previous Message | Dado Feigenblatt | 2001-07-07 00:20:36 | Re: indexing of hierarchical data |