As the this is a NEW record there is no OLD value! (and would it be bette to use a BEFORE insert?) Regards torben [EMAIL PROTECTED] writes:
> Hallo, > > What is wrong with this trigger: > > I want the trigger to fire(to run the statement : UPPER(SUBSTR(:OLD.namn, 1, 1)) || >SUBSTR(:OLD.namn,2); > after new record is inserted in this table. > > The thing to happen should be this: > > I want that script to be run on the same record that has been inserted in the table. >So the UPPer command should run on the namn field that has been inserted in the table. > Hope anyone can´help me. > > CREATE OR REPLACE TRIGGER AFTER_INSERT_ROWins_ON_test > after insert > ON test > REFERENCING NEW AS NEW OLD AS OLD > FOR EACH ROW > BEGIN > > :NEW.namn :=UPPER(SUBSTR(:OLD.namn, 1, 1)) || SUBSTR(:OLD.namn,2); > -- :NEW.namn := UPPER(SUBSTR(:OLD.namn, 1, 1) || SUBSTR(:OLD.namn), 2); > EXCEPTION > WHEN OTHERS THEN > raise_application_error(-20000, 'ERROR IN TRIGGER AFTER_INSERT_ROWins_ON_test: ' >|| SQLERRM); > > END; > > / > > > Thanks in advance > > Roland S > > -- > Please see the official ORACLE-L FAQ: http://www.orafaq.com > -- > Author: > INET: [EMAIL PROTECTED] > > Fat City Network Services -- (858) 538-5051 FAX: (858) 538-5051 > San Diego, California -- Public Internet access / Mailing Lists > -------------------------------------------------------------------- > To REMOVE yourself from this mailing list, send an E-Mail message > to: [EMAIL PROTECTED] (note EXACT spelling of 'ListGuru') and in > the message BODY, include a line containing: UNSUB ORACLE-L > (or the name of mailing list you want to be removed from). You may > also send the HELP command for other information (like subscribing). ------------------------------------------------------------ Torben Holm Miracle A/S mobil: +45 2527 7104 mail : [EMAIL PROTECTED] http://www.miracleas.dk -- Please see the official ORACLE-L FAQ: http://www.orafaq.com -- Author: INET: [EMAIL PROTECTED] Fat City Network Services -- (858) 538-5051 FAX: (858) 538-5051 San Diego, California -- Public Internet access / Mailing Lists -------------------------------------------------------------------- To REMOVE yourself from this mailing list, send an E-Mail message to: [EMAIL PROTECTED] (note EXACT spelling of 'ListGuru') and in the message BODY, include a line containing: UNSUB ORACLE-L (or the name of mailing list you want to be removed from). You may also send the HELP command for other information (like subscribing).