oracle - Unknown "SP2-0552: Bind variable "NEW" not declared" message on trigger -


i have trigger in 1 of scripts:

    create or replace trigger ms_db.db_tr_incrementtrialnumber before insert  on ms_db.db_summary each row  begin     update ms_db.db_summary set ms_db.db_summary.timesgenerated =         (select coalesce(max(timesgenerated),0)+1           ms_db.db_summary          ms_db.db_summary.stepid = :new.stepid ,           ms_db.db_summary.validationid = :new.validationid ,            ms_db.db_summary.summarydate = :new.summarydate);     ms_db.db_summary.id = :new.id; end; / 

i use toad executing the script. when use 'execute script' button works fine. when run in sqlplus window line :

sp2-0552: bind variable "new" not declared 

any ideas why getting this? thanks

by default sql*plus treats blank line end of statement. first line, create, never executed. rest executed anonymous block, , no longer part of trigger statement new isn't recognised.

you can either remove blank line before begin, or set sqlblanklines off before start.


Comments