CREATE TABLE UPS_DEINFO
(
   DEROWID varchar(64) NOT NULL,
   DATASETUUID varchar(64) NOT NULL,
   GROUPNUMBER int NOT NULL,
   ELEMENTNUMBER int NOT NULL,
   ISSQ smallint NOT NULL,
   PARENTSQUID varchar(64),
   VALUE varchar(64),
   SQUUID varchar(64),
   ITEMUUID varchar(64),
   DELEVEL int NOT NULL,
   DEVR int
)
;

CREATE TABLE UPS
(
   STEPID varchar(64) NOT NULL,
   DATASETUUID varchar(64) NOT NULL,
   SOPINSTANCEUID varchar (64) NOT NULL,
   RECEIVINGAE varchar(64) ,
   DELETIONLOCK varchar(64) 
  
);

ALTER TABLE UPS_DEINFO ADD 
	CONSTRAINT UPS_DEINFO_PK PRIMARY KEY 
	(
		DEROWID
	);

ALTER TABLE UPS ADD 
	CONSTRAINT UPS_PK PRIMARY KEY 
	(
		DATASETUUID
	);

ALTER TABLE UPS_DEINFO ADD 
	CONSTRAINT UPS_DEINFO_UPS_FK00 FOREIGN KEY 
	(
		DATASETUUID
	) REFERENCES UPS(
		DATASETUUID
	)on delete cascade;
