I am trying to create sequence and trigger by using sqlplus
and everything is written in term of bash script.
My code is as following
su -p oracle -c "$ORACLE_HOME/bin/sqlplus -l mydb/mypass@localhost:1521/xe << !
create sequence SEQ_NAME start with 1000 maxvalue 9999;
create or replace trigger TRG_NAME
before insert on TABLE_NAME
for each row
begin
select SEQ_NAME.nextval into :new.MY_ID from dual;
end;
!
"
After executing the above command, I expected to receive some logs look like
Sequence created
Trigger compiled
But only the log Sequence created
appears. As a result, only the sequence is created and trigger is not created. I know that by checking on SQL Developer tool
The thing is when I use SQL Developer tool and execute the script
create sequence SEQ_NAME start with 1000 maxvalue 9999;
create or replace trigger TRG_NAME
before insert on TABLE_NAME
for each row
begin
select SEQ_NAME.nextval into :new.MY_ID from dual;
end;
Then everything works fine! Sequence and Trigger are created!
Any idea for this problem?