Problem with Oracle Script - creating a trigger without interruption

I am trying to make some changes to the oracle database and create a script for this. The problem is that when it reaches the point in the script where I create the trigger, it seems that the Create Trigger block does not end properly, when I look at the trigger after that, it contains all the remaining code in the script.

This is what I have:

CREATE OR REPLACE TRIGGER user_publish_log_trg
  BEFORE INSERT ON USER_PUBLISH_LOG
  FOR EACH ROW
    BEGIN
    SELECT user_publish_log_seq.NEXTVAL INTO :NEW.Id FROM dual;
    END user_publish_log_trg;

CREATE TABLE USER_APPROVAL_LOG
(
    Id number(10) NOT NULL ,
    CommodityId number(10) NOT NULL,
    QuarterEndDate DATE NOT NULL,
    ActionId int NOT NULL ,
...

What am I doing wrong at the end of a trigger?

+3
source share
1 answer

You need to end PL / SQL with a slash in a new line, for example:

CREATE OR REPLACE TRIGGER user_publish_log_trg
  BEFORE INSERT ON USER_PUBLISH_LOG
  FOR EACH ROW
    BEGIN
    SELECT user_publish_log_seq.NEXTVAL INTO :NEW.Id FROM dual;
    END user_publish_log_trg;
/

CREATE TABLE USER_APPROVAL_LOG
(
    Id number(10) NOT NULL ,
    CommodityId number(10) NOT NULL,
    QuarterEndDate DATE NOT NULL,
    ActionId int NOT NULL ,
...
+13
source

Source: https://habr.com/ru/post/1765645/


All Articles