-- Licensed Materials - Property of IBM
-- BI and PM: Mobile
-- (C) Copyright IBM Corp. 2007, 2012
-- US Government Users Restricted Rights - Use, duplication or disclosure restricted by GSA ADP Schedule Contract with IBM Corp.

DECLARE
	TABLE_EXISTS_EXCEPTION EXCEPTION;
	PRAGMA EXCEPTION_INIT (TABLE_EXISTS_EXCEPTION, -955);
BEGIN
	EXECUTE IMMEDIATE 'CREATE TABLE MOB_DRILLS (
		SOURCE_RENDER_ID int NOT NULL,
		TARGET_RENDER_ID int NOT NULL,
		DRILL_CONTEXT varchar (1000) NOT NULL,
		DRILL_TYPE smallint NOT NULL,
		CONSTRAINT FK_MOB_D_SRID FOREIGN KEY(SOURCE_RENDER_ID) REFERENCES MOB_RENDERS(RENDER_ID) ON DELETE CASCADE
	)';
EXCEPTION
	WHEN TABLE_EXISTS_EXCEPTION THEN
		NULL;
END;
/
-- MOB_DRILL_TYPES
DECLARE
	TABLE_EXISTS_EXCEPTION EXCEPTION;
	PRAGMA EXCEPTION_INIT (TABLE_EXISTS_EXCEPTION, -955);
BEGIN
	EXECUTE IMMEDIATE 'CREATE TABLE MOB_DRILL_TYPES (
		TYPE smallint NOT NULL,
		DESCRIPTION varchar (100) NULL
	)';
	EXECUTE IMMEDIATE 'INSERT INTO MOB_DRILL_TYPES VALUES (0, ''REGULAR'')';
	EXECUTE IMMEDIATE 'INSERT INTO MOB_DRILL_TYPES VALUES (1, ''ASTRO'')';
EXCEPTION
	WHEN TABLE_EXISTS_EXCEPTION THEN
		NULL;
END;
/
