Oracle FAQ | Your Portal to the Oracle Knowledge Grid |
Home -> Community -> Mailing Lists -> Oracle-L -> RE: Trigger question
This should work:
CREATE TRIGGER "BEFORE_ROWUPD_ON_TEST"
BEFORE UPDATE OF namn
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);
EXCEPTION
WHEN OTHERS THEN
raise_application_error(-20000, 'ERROR IN TRIGGER BEFORE_ROWUPD_ON_TEST:
' || SQLERRM);
END;
/
> Med vänliga hälsningar/ Kind regards
> ----------
> Från: Roland.Skoldblom_at_ica.se[SMTP:Roland.Skoldblom_at_ica.se]
> Svara till: ORACLE-L_at_fatcity.com
> Skickat: Thursday, March 28, 2002 12:33 PM
> Till: Multiple recipients of list ORACLE-L
> Angående: Trigger question
>
> Hallo,
>
> anyone who can please helpme with a trigger script that does the
> following:
>
> I want this script to run when I have updated a field in a table.
>
> update test set namn = upper(substr(namn,1,1) || substr(namn),2)
>
> I want this trigger to fire only for the selected record(row), that is
> going to be updated. Please help me with this, it might seem simple but I
> cant get it right.
>
> 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).
>
-- Please see the official ORACLE-L FAQ: http://www.orafaq.com -- Author: =?iso-8859-1?Q?Per_Bergh=E4ll?= INET: per.berghall_at_veriba.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).Received on Thu Mar 28 2002 - 06:33:39 CST