Tim Dudgeon <[email protected]> writes: > On 03/09/2014 13:21, Knut Anders Hatlen wrote: >> I don't think so. Derby doesn't allow UPDATE statements in BEFORE >> triggers > > I was meaning to just set the column value from the sequence into the > new values, not using an insert statement. In my Oracle version its > like this: > CREATE OR REPLACE TRIGGER samples_code_trg BEFORE INSERT ON samples > FOR EACH ROW > BEGIN > SELECT TO_CHAR(seq_sample_code.nextval) INTO :NEW.sample_code FROM > dual; END; > > I've never had much joy with BEFORE INSERT triggers on Derby.
Derby doesn't allow you to change the new values in triggers, I'm afraid. As you've noticed, there's not a whole lot you can do with BEFORE triggers in Derby... -- Knut Anders
