
/*------ ATD 298737 ------*/
DECLARE v_count NUMBER:=0;
BEGIN
   SELECT 1 INTO v_count FROM USER_TAB_COLUMNS WHERE Upper(table_name) = 'CFOSAIDCAD' AND Upper(column_name) = 'ID'; 
   EXCEPTION
   WHEN NO_DATA_FOUND THEN
      BEGIN
        EXECUTE IMMEDIATE 'CREATE OR REPLACE TRIGGER CFOSAIDCAD_I
        BEFORE INSERT ON CFOSAIDCAD for each ROW
        WHEN (new.ID IS NULL)
            BEGIN
                SELECT CFOSAIDCAD_SEQ.NEXTVAL INTO :new.ID FROM dual;
            END;';
     END;
END;

