alter table wf_group_object_def add constraint wf_group_object_id_version_pk primary key(id,version_start);
alter table wf_group_object_def add constraint wf_group_object_id_versionEnd unique(id, version_end);
alter table wf_group_def add version_start number default 0 not null;
alter table wf_group_def add version_end number default 0;
alter table wf_group_def add constraint wf_group_def_chk_version CHECK (nvl(version_start, 0)>=0 AND (nvl(version_end,version_start)>=version_start OR nvl(version_end,0)=0));
declare
lsql varchar2(1000);
lcons_name varchar2(100);
begin
-- Drop a primary key constraint for a given table
-- This script needs to be run as a rator user. Also, please be aware that data dictionaries are case sensitive,
-- ie. uppercase table name
select constraint_name into lcons_name from user_constraints where TABLE_NAME = 'WF_GROUP_DEF' and
constraint_type = 'P';
lsql := 'alter table wf_group_def drop constraint ' || lcons_name || ' cascade drop index';
dbms_output.put_line(lsql);
execute immediate lsql;
end; |