Last active
November 8, 2016 02:50
-
-
Save bradbrowne/386a121614687d810e1c08e4397e84c4 to your computer and use it in GitHub Desktop.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
create or replace TRIGGER ASSET.ASSET_ID_BASE_POINT_TR | |
-- Automatically assigns new ASSET_ID based on a Sequence | |
BEFORE INSERT | |
OR UPDATE -- Required for ArcGIS REST API compatibility | |
ON ASSET.ASSET_BASE_POINT | |
FOR EACH ROW | |
DECLARE | |
BEGIN | |
IF :NEW.asset_id IS NULL THEN | |
IF :OLD.asset_id IS NULL THEN | |
-- Assign new value from Sequence | |
:NEW.asset_id := ASSET.ASSET_ID_SQ.NEXTVAL; | |
ELSE | |
-- Do not get another value from Sequence | |
:NEW.asset_id := :OLD.asset_id; | |
END IF; | |
END IF; | |
EXCEPTION WHEN OTHERS THEN RAISE; END; |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment