Oracle Trigger Update After Insert on its own table

CREATE OR REPLACE TRIGGER AUTOCREATION_NIP_PERSONLUAR
AFTER INSERT ON SPPD_TMST_PERSONLUAR
DECLARE nextuserid number;
BEGIN
select max(userid)
into nextuserid
from sppd_plne.sppd_tmst_personluar;

UPDATE sppd_plne.SPPD_TMST_PERSONLUAR  set NIP =  concat(‘ORGLUAR’,nextuserid)  WHERE userid = nextuserid  ;
END;

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out / Change )

Twitter picture

You are commenting using your Twitter account. Log Out / Change )

Facebook photo

You are commenting using your Facebook account. Log Out / Change )

Google+ photo

You are commenting using your Google+ account. Log Out / Change )

Connecting to %s

%d bloggers like this: