You are viewing a plain text version of this content. The canonical link for it is here.
Posted to derby-user@db.apache.org by Peter Bowman <pe...@hotmail.com> on 2006/04/11 13:06:41 UTC

Unable To Create Multiple Row Inserting Trigger

Hi All,

I can create a trigger exactly like the following:

CREATE TRIGGER TEST AFTER INSERT ON PLAN_NAME_TABLE REFERENCING NEW AS 
NEWROW FOR EACH ROW MODE DB2SQL INSERT INTO PLAN_NUTRIENT_TABLE VALUES 
(NEWROW.PLAN, 'Total Fat', 'Fat', DEFAULT, 'g', DEFAULT, DEFAULT);

but if I try to insert more than a single row using the trigger, as shown 
below, I can't create it.

CREATE TRIGGER TEST AFTER INSERT ON PLAN_NAME_TABLE REFERENCING NEW AS 
NEWROW FOR EACH ROW MODE DB2SQL INSERT INTO PLAN_NUTRIENT_TABLE VALUES 
(NEWROW.PLAN, 'Total Fat', 'Fat', DEFAULT, 'g', DEFAULT, DEFAULT), 
(NEWROW.PLAN, 'Total Protein', 'Protein', DEFAULT, 'g', DEFAULT, DEFAULT);

I get a String index out of bounds error (always -8).

I've tried to find my error until I'm blue in the face, but I can't see what 
I am doing wrong.

Any ideas, thanks,

Peter.



Re: Unable To Create Multiple Row Inserting Trigger

Posted by Daniel John Debrunner <dj...@apache.org>.
Peter Bowman wrote:

> Hi All,
> 
> I can create a trigger exactly like the following:
> 
> CREATE TRIGGER TEST AFTER INSERT ON PLAN_NAME_TABLE REFERENCING NEW AS
> NEWROW FOR EACH ROW MODE DB2SQL INSERT INTO PLAN_NUTRIENT_TABLE VALUES
> (NEWROW.PLAN, 'Total Fat', 'Fat', DEFAULT, 'g', DEFAULT, DEFAULT);
> 
> but if I try to insert more than a single row using the trigger, as
> shown below, I can't create it.
> 
> CREATE TRIGGER TEST AFTER INSERT ON PLAN_NAME_TABLE REFERENCING NEW AS
> NEWROW FOR EACH ROW MODE DB2SQL INSERT INTO PLAN_NUTRIENT_TABLE VALUES
> (NEWROW.PLAN, 'Total Fat', 'Fat', DEFAULT, 'g', DEFAULT, DEFAULT),
> (NEWROW.PLAN, 'Total Protein', 'Protein', DEFAULT, 'g', DEFAULT, DEFAULT);
> 
> I get a String index out of bounds error (always -8).
> 
> I've tried to find my error until I'm blue in the face, but I can't see
> what I am doing wrong.

This is a bug, I see it on a simple trigger example. Am looking into
what the cause is.

Dan.