Aamir
Aamir

Reputation: 2424

Error using trigger in Oracle sql

CREATE OR REPLACE TRIGGER bi_payregister
  BEFORE INSERT
  ON payregister
  FOR EACH ROW
BEGIN
  SELECT helloabc.NEXTVAL INTO :new.id FROM DUAL;
END

what is wrong with this statement, it shows error.I have created PAYREGISTER table and HelloABC sequence already.

Upvotes: 0

Views: 38

Answers (1)

Boneist
Boneist

Reputation: 23578

Assuming you're talking about the syntax error that your code produces, you're missing the semi-colon (and forward slash) off the end of the "END". It should be:

CREATE OR REPLACE TRIGGER bi_payregister
  BEFORE INSERT
  ON payregister
  FOR EACH ROW
BEGIN
  SELECT helloabc.NEXTVAL INTO :new.id FROM DUAL;
END;
/

Upvotes: 2

Related Questions