on 12-28-2016 11:14 AM
Hi All,
Actually i have a requirement to create a trigger.If a record is inserted into the Table then after it should Update one of the column after the insert.
In trigger i found that the subject table (table for creating a trigger) cant be supported to delete or update operation.
Now for that again i took one more table and fulfilling my requirement.
But it is throwing this error
transaction rolled back by an internal error:
Could any body please help me to resolve my issue.
Here is my Coding.
CREATE TRIGGER "VALUE"."GD_VOLUME_COUNT" AFTER INSERT ON "VALUE"."VF_GDVOLUME_TEMP" REFERENCING NEW ROW MYNEWROW FOR EACH ROW
BEGIN
DECLARE V_DATE SECONDDATE;
DECLARE V_COUNTER INTEGER;
DECLARE V_COUNTER_AFTER_DIFF INTEGER;
DECLARE V_SECONDS INTEGER;
--Here first am fetching the very last row from the table to calculate the time difference and counter value
SELECT DATE_TIMESTAMP,COUNTER INTO V_DATE,V_COUNTER FROM "VALUE"."VF_GDVOLUME_TEMP" ORDER BY DATE_TIMESTAMP DESC LIMIT 1;
V_COUNTER_AFTER_DIFF = :MYNEWROW.COUNTER - V_COUNTER;
INSERT INTO "VALUE"."VF_GDVOLUME_COUNT" VALUES( :MYNEWROW.EVENTID,
:MYNEWROW.TAG_ID,
:MYNEWROW.LINE,
:MYNEWROW.MACHINE,
:MYNEWROW.SKU_ID,
:MYNEWROW.DATE_TIMESTAMP,
:MYNEWROW.COUNTER,
:MYNEWROW.UOM, NULL,
:MYNEWROW.ACTUAL_SPEED_UOM,
:MYNEWROW.FLAG );
UPDATE "VALUE"."VF_GDVOLUME_COUNT" SET ACTUAL_SPEED = 3600/(SECONDS_BETWEEN(V_DATE,:MYNEWROW.DATE_TIMESTAMP)*V_COUNTER_AFTER_DIFF) WHERE DATE_TIMESTAMP = :MYNEWROW.DATE_TIMESTAMP;
END
Please kindly help me to resolve my issue.
User | Count |
---|---|
86 | |
10 | |
10 | |
9 | |
7 | |
7 | |
6 | |
5 | |
4 | |
4 |
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.