Trigger to Assign sequence as PK

Oracle Application Express is a rapid development tool for Web applications on the Oracle database.
Post Reply
admin
Posts: 1980
Joined: Fri Mar 31, 2006 12:59 am
Location: Pakistan
Contact:

Trigger to Assign sequence as PK

Post by admin »

create or replace SEQUENCE JS_HEALTH_CHECK_seq start with 1 nocache;

CREATE OR REPLACE TRIGGER JS_HEALTH_CHECK_BIU
before insert OR UPDATE ON JS_HEALTH_CHECK
for each row
BEGIN
IF :NEW.ID IS NULL THEN
SELECT JS_HEALTH_CHECK_seq.nextval INTO :NEW.ID FROM sys.dual;
END IF;
END;
/
Post Reply

Who is online

Users browsing this forum: No registered users and 0 guests