procedure BIM_AUX_DoplnTriggery as -- cursor c_id is select 'create trigger '||table_name||'_ID' ||chr(10)||'before insert on '||table_name ||chr(10)||'for each row' ||chr(10)||'begin' ||chr(10)||' :NEW.ID := coalesce(:NEW.ID,nextid);' ||chr(10)||'end;' ||chr(10)||'/' stmt from user_tab_columns utc where utc.column_name='ID' and utc.table_name not in (select view_name from user_views) and table_name||'_ID' not in (select trigger_name from user_triggers); -- cursor c_kdo is select 'create trigger '||table_name||'_KDO' ||chr(10)||'before insert or update on '||table_name ||chr(10)||'for each row' ||chr(10)||'begin' ||chr(10)||' :NEW.KDO := USER;' ||chr(10)||' :NEW.KDY := SYSDATE;' ||chr(10)||'end;' ||chr(10)||'/' stmt from user_tab_columns utc where utc.column_name='KDO' and utc.table_name not in (select view_name from user_views) and table_name||'_KDO' not in (select trigger_name from user_triggers); -- begin -- for r in c_id loop dbms_output.put_line(r.stmt); begin execute immediate rtrim(r.stmt,'/'||chr(10)); exception when others then dbms_output.put_line(CHR(10)||SQLERRM||CHR(10)); end; end loop; -- for r in c_kdo loop dbms_output.put_line(r.stmt); begin execute immediate rtrim(r.stmt,'/'||chr(10)); exception when others then dbms_output.put_line(CHR(10)||SQLERRM||CHR(10)); end; end loop; -- end BIM_AUX_DoplnTriggery;