I have a program unit in a forms 10g form invoked by a when button pressed trigger as shown below
PROCEDURE truncate_tables IS
v_start varchar2(4);
v_end varchar2(4);
v_alert_button number;
BEGIN
select distinct(esr_period)
into :multi_month.start_date
from svl_periods a, data_extracts b
where b.report_effective_date = a.period_end_date
and b.report_effective_date = (select min(c.report_effective_date) from data_extracts c
where c.status = 'COMPLETED');
select distinct(esr_period)
into :multi_month.end_date
from svl_periods a, data_extracts b
where b.report_effective_date = a.period_end_date
and b.report_effective_date = (select max(c.report_effective_date) from data_extracts c
where c.status = 'COMPLETED');
synchronize;
v_alert_button := get_alert_val('ALERT_YN', 'Please confirm start and end dates are correct');
IF v_alert_button = 88 THEN
Forms_DDL('truncate table employee;');
IF NOT Form_Success then
Message('Truncate Employee Faled');
END IF;
Forms_DDL('truncate table maternity;');
IF NOT Form_Success then
Message('Truncate Maternity Faled');
END IF;
Forms_DDL('truncate table sickness;');
IF NOT Form_Success then
Message('Truncate Sickness Faled');
END IF;
Forms_DDL('truncate table leaver;');
IF NOT Form_Success then
Message('Truncate Leaver Faled');
END IF;
Forms_DDL('truncate table data_extracts;');
IF NOT Form_Success then
Message('Truncate Data Extracts Faled');
END IF;
Forms_DDL('truncate table reorganisations;');
IF NOT Form_Success then
Message('Truncate Reorganisations Faled');
END IF;
Forms_DDL('truncate table org_structure;');
IF NOT Form_Success then
Message('Truncate Org Structure Faled');
END IF;
Forms_DDL('drop sequence esr_emp_id_s;');
IF NOT Form_Success then
Message('Drop esr_emp_id_s Faled');
END IF;
Forms_DDL('drop sequence esr_leave_id_s;');
IF NOT Form_Success then
Message('Drop esr_leave_id_s Faled');
END IF;
Forms_DDL('drop sequence esr_mat_id_s;');
IF NOT Form_Success then
Message('Drop esr_mat_id_s Faled');
END IF;
Forms_DDL('drop sequence extract_id_seq;');
IF NOT Form_Success then
Message('Drop extract_id Faled');
END IF;
Forms_DDL('drop sequence mat_refno_s;');
IF NOT Form_Success then
Message('Drop mat_refno_s Faled');
END IF;
Forms_DDL('drop sequence org_levels_seq;');
IF NOT Form_Success then
Message('Drop org_levels_seq Faled');
END IF;
Forms_DDL('drop sequence sick_refno_s;');
IF NOT Form_Success then
Message('Drop sick_refno_s Faled');
END IF;
Forms_DDL('create sequence esr_emp_id_s nocache;');
IF NOT Form_Success then
Message('Create esr_emp_id_s Faled');
END IF;
Forms_DDL('create sequence esr_leave_id_s nocache;');
IF NOT Form_Success then
Message('Create esr_leave_id_s Faled');
END IF;
Forms_DDL('create sequence esr_mat_id_s nocache;');
IF NOT Form_Success then
Message('Create esr_mat_id_s Faled');
END IF;
Forms_DDL('create sequence extract_id_seq nocache;');
IF NOT Form_Success then
Message('Create extract Faled');
END IF;
Forms_DDL('create sequence mat_refno_s nocache;');
IF NOT Form_Success then
Message('Create mat_refno_s Faled');
END IF;
Forms_DDL('create sequence org_levels_seq nocache;');
IF NOT Form_Success then
Message('Create org_levels_seq Faled');
END IF;
Forms_DDL('create sequence sick_refno_s nocache;');
IF NOT Form_Success then
Message('Create sick_refno_s Faled');
END IF;
END IF;
END;
However all of the forms_ddl statements are failing. I have not used forms ddl to do this before so may have done something stupid. Any help would be appreciated.
Regards
Tina