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: Per Berghäll <per.berghall_at_veriba.se>
Date: Thu, 28 Mar 2002 04:33:39 -0800
Message-ID: <F001.00435CB7.20020328043339@fatcity.com>


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



Veriba AB
Per Berghäll
Brigadgatan 10
581 31 Linköping
Tel: +46 (0)13-362600
Fax: +46 (0)13-362625
mailto:per.berghall_at_veriba.se
http://www.veriba.se

> ----------
> 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

Original text of this message

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