Oracle FAQ Your Portal to the Oracle Knowledge Grid
HOME | ASK QUESTION | ADD INFO | SEARCH | E-MAIL US
 

Home -> Community -> Mailing Lists -> Oracle-L -> Re: Trigger question

Re: Trigger question

From: <torben.holm_at_miracleas.dk>
Date: Wed, 03 Apr 2002 03:48:38 -0800
Message-ID: <F001.00439AD5.20020403034838@fatcity.com>


As the this is a NEW record there is no OLD value! (and would it be bette to use a BEFORE insert?) Regards
torben
Roland.Skoldblom_at_ica.se 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: Roland.Skoldblom_at_ica.se
>
> 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: ListGuru_at_fatcity.com (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 : torben.holm_at_miracleas.dk

http://www.miracleas.dk

-- 
Please see the official ORACLE-L FAQ: http://www.orafaq.com
-- 
Author: 
  INET: torben.holm_at_miracleas.dk

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: ListGuru_at_fatcity.com (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).
Received on Wed Apr 03 2002 - 05:48:38 CST

Original text of this message

HOME | ASK QUESTION | ADD INFO | SEARCH | E-MAIL US