	CREATE OR REPLACE PROCEDURE CreatePMM IS 
        wk_message	varchar2(500);
        wk_count		number;
        err_msg		varchar2(500);
	BEGIN
	
		wk_message := '';
		--DELETE FROM SYS.INSTALL_TABLE;
				
		/*------------------------------------------------------------------
								Create PMM Tables
		------------------------------------------------------------------*/
		
		-- CREATE TABLE PMM_TitleStatus
		BEGIN
			EXECUTE IMMEDIATE 'CREATE TABLE WFS.PMM_TitleStatus (
										ID_			NUMBER 		NOT NULL,
										Description	VARCHAR(25)	NOT NULL,
										CREATEDATE 	TIMESTAMP(6) DEFAULT (SYSTIMESTAMP) NOT NULL,
          							UPDATEDATE 	TIMESTAMP(6) DEFAULT (SYSTIMESTAMP) NOT NULL )
          							TABLESPACE WFS_DATA';
		EXCEPTION 
			WHEN OTHERS THEN
				wk_message := 'ERROR';
				err_msg :=SUBSTR(SQLERRM, 1, 500);
				EXECUTE IMMEDIATE 'INSERT INTO install_table values (''error in installing of application database objects:'||
            	 					'Unable to create table PMM_TitleStatus.'')';
            EXECUTE IMMEDIATE 'INSERT INTO install_table values ('''||err_msg||''')';
        GOTO bypass_install;
				
		END;
		
		-- Creating PMM_TitleStatus Primary Key
		BEGIN
		
		EXECUTE IMMEDIATE 'ALTER TABLE WFS.PMM_TitleStatus
		ADD ( CONSTRAINT PK_PMM_TitleStatus
		PRIMARY KEY (ID_)
		NOT DEFERRABLE INITIALLY IMMEDIATE
		USING INDEX
		TABLESPACE WFS_INDEX )';
		
		EXCEPTION 
			WHEN OTHERS THEN
				wk_message := 'ERROR';
				err_msg :=SUBSTR(SQLERRM, 1, 500);
				EXECUTE IMMEDIATE 'INSERT INTO install_table values (''error in installing of application database objects:'||
            	 					'Unable to create primary key for PMM_TitleStatus.'')';
            EXECUTE IMMEDIATE 'INSERT INTO install_table values ('''||err_msg||''')';
        GOTO bypass_install;
		
		END;
		
		-- CREATE TABLE PMM_Title
		BEGIN
			EXECUTE IMMEDIATE 'CREATE TABLE WFS.PMM_Title (
										ID_					NUMBER 			NOT NULL,
										TitleName			VARCHAR2(50)		 NULL,
										TitleStatusID		NUMBER				 NULL,
										Specification		VARCHAR2(25)		 NULL,
										ParentID				NUMBER				 NULL,
										RootTitleID			NUMBER				 NULL,
										ProviderID			NUMBER				 NULL,
										IsActive				NUMBER(1,0)		DEFAULT (1) NOT NULL,
										InternalLocation	VARCHAR2(100)  	 NULL,
										MetaDataLocation	VARCHAR2(100)  	 NULL,
										EXTERNALLOCATION 	VARCHAR2(50)		 NULL,
										CREATEDATE 			TIMESTAMP(6) DEFAULT (SYSTIMESTAMP) NOT NULL,
          							UPDATEDATE 			TIMESTAMP(6) DEFAULT (SYSTIMESTAMP) NOT NULL )
          							TABLESPACE WFS_DATA';
		EXCEPTION 
			WHEN OTHERS THEN
				wk_message := 'ERROR';
				err_msg :=SUBSTR(SQLERRM, 1, 500);
				EXECUTE IMMEDIATE 'INSERT INTO install_table values (''error in installing of application database objects:'||
            	 					'Unable to create table PMM_Title.'')';
            EXECUTE IMMEDIATE 'INSERT INTO install_table values ('''||err_msg||''')';
        GOTO bypass_install;
				
		END;
		
		-- Creating PMM_Title Primary Key
		BEGIN
		
		EXECUTE IMMEDIATE 'ALTER TABLE WFS.PMM_Title
		ADD ( CONSTRAINT PK_PMM_Title
		PRIMARY KEY (ID_)
		NOT DEFERRABLE INITIALLY IMMEDIATE
		USING INDEX
		TABLESPACE WFS_INDEX )';
		
		EXCEPTION 
			WHEN OTHERS THEN
				wk_message := 'ERROR';
				err_msg :=SUBSTR(SQLERRM, 1, 500);
				EXECUTE IMMEDIATE 'INSERT INTO install_table values (''error in installing of application database objects:'||
            	 					'Unable to create primary key for PMM_Title.'')';
            EXECUTE IMMEDIATE 'INSERT INTO install_table values ('''||err_msg||''')';
        GOTO bypass_install;
		
		END;
		
		-- CREATE TABLE PMM_TitleMetaData
		BEGIN
			EXECUTE IMMEDIATE 'CREATE TABLE WFS.PMM_TitleMetaData (
										ID_			NUMBER 		NOT NULL,
										TitleID		NUMBER		NOT NULL,
										RootTitleID	NUMBER		NOT NULL,
										DataTypeID	NUMBER DEFAULT(2) NOT NULL,
										Name			VARCHAR(64)	NOT NULL,
										Value			VARCHAR(255)	 NULL,
										CREATEDATE 	TIMESTAMP(6) DEFAULT (SYSTIMESTAMP) NOT NULL,
          							UPDATEDATE 	TIMESTAMP(6) DEFAULT (SYSTIMESTAMP) NOT NULL )
          							TABLESPACE WFS_DATA';
		EXCEPTION 
			WHEN OTHERS THEN
				wk_message := 'ERROR';
				err_msg :=SUBSTR(SQLERRM, 1, 500);
				EXECUTE IMMEDIATE 'INSERT INTO install_table values (''error in installing of application database objects:'||
            	 					'Unable to create table .'')';
            EXECUTE IMMEDIATE 'INSERT INTO install_table values ('''||err_msg||''')';
        GOTO bypass_install;
				
		END;

		-- Creating PMM_TitleMetaData Primary Key
		BEGIN
		
		EXECUTE IMMEDIATE 'ALTER TABLE WFS.PMM_TitleMetaData
		ADD ( CONSTRAINT PK_PMM_TitleMetaData
		PRIMARY KEY (ID_)
		NOT DEFERRABLE INITIALLY IMMEDIATE
		USING INDEX
		TABLESPACE WFS_INDEX )';
		
		EXCEPTION 
			WHEN OTHERS THEN
				wk_message := 'ERROR';
				err_msg :=SUBSTR(SQLERRM, 1, 500);
				EXECUTE IMMEDIATE 'INSERT INTO install_table values (''error in installing of application database objects:'||
            	 					'Unable to create primary key for PMM_TitleMetaData.'')';
            EXECUTE IMMEDIATE 'INSERT INTO install_table values ('''||err_msg||''')';
        GOTO bypass_install;
		
		END;
		
		-- CREATE TABLE PMM_TitleListStatus
		BEGIN
			EXECUTE IMMEDIATE 'CREATE TABLE WFS.PMM_TitleListStatus (
										ID_			NUMBER 		NOT NULL,
										Description	VARCHAR(25) NOT NULL,
										CREATEDATE 	TIMESTAMP(6) DEFAULT (SYSTIMESTAMP) NOT NULL,
          							UPDATEDATE 	TIMESTAMP(6) DEFAULT (SYSTIMESTAMP) NOT NULL )
          							TABLESPACE WFS_DATA';
		EXCEPTION 
			WHEN OTHERS THEN
				wk_message := 'ERROR';
				err_msg :=SUBSTR(SQLERRM, 1, 500);
				EXECUTE IMMEDIATE 'INSERT INTO install_table values (''error in installing of application database objects:'||
            	 					'Unable to create table PMM_TitleListStatus.'')';
            EXECUTE IMMEDIATE 'INSERT INTO install_table values ('''||err_msg||''')';
        GOTO bypass_install;
				
		END;
		
		-- Creating PMM_TitleListStatus Primary Key
		BEGIN
		
		EXECUTE IMMEDIATE 'ALTER TABLE WFS.PMM_TitleListStatus
		ADD ( CONSTRAINT PK_PMM_TitleListStatus
		PRIMARY KEY (ID_)
		NOT DEFERRABLE INITIALLY IMMEDIATE
		USING INDEX
		TABLESPACE WFS_INDEX )';
		
		EXCEPTION 
			WHEN OTHERS THEN
				wk_message := 'ERROR';
				err_msg :=SUBSTR(SQLERRM, 1, 500);
				EXECUTE IMMEDIATE 'INSERT INTO install_table values (''error in installing of application database objects:'||
            	 					'Unable to create primary key for PMM_TitleListStatus.'')';
            EXECUTE IMMEDIATE 'INSERT INTO install_table values ('''||err_msg||''')';
        GOTO bypass_install;
		
		END;
	
		-- CREATE TABLE PMM_LISTTYPE
		BEGIN
			EXECUTE IMMEDIATE 'CREATE TABLE WFS.PMM_LISTTYPE (
										ID_			NUMBER 		NOT NULL,
										Description	VARCHAR(25) NOT NULL,
										CREATEDATE 	TIMESTAMP(6) DEFAULT (SYSTIMESTAMP) NOT NULL,
          							UPDATEDATE 	TIMESTAMP(6) DEFAULT (SYSTIMESTAMP) NOT NULL )
          							TABLESPACE WFS_DATA';
		EXCEPTION 
			WHEN OTHERS THEN
				wk_message := 'ERROR';
				err_msg :=SUBSTR(SQLERRM, 1, 500);
				EXECUTE IMMEDIATE 'INSERT INTO install_table values (''error in installing of application database objects:'||
            	 					'Unable to create table PMM_LISTTYPE.'')';
            EXECUTE IMMEDIATE 'INSERT INTO install_table values ('''||err_msg||''')';
        GOTO bypass_install;
				
		END;

		-- Creating PMM_LISTTYPE Primary Key
		BEGIN
		
		EXECUTE IMMEDIATE 'ALTER TABLE WFS.PMM_LISTTYPE
		ADD ( CONSTRAINT PK_PMM_LISTTYPE
		PRIMARY KEY (ID_)
		NOT DEFERRABLE INITIALLY IMMEDIATE
		USING INDEX
		TABLESPACE WFS_INDEX )';
		
		EXCEPTION 
			WHEN OTHERS THEN
				wk_message := 'ERROR';
				err_msg :=SUBSTR(SQLERRM, 1, 500);
				EXECUTE IMMEDIATE 'INSERT INTO install_table values (''error in installing of application database objects:'||
            	 					'Unable to create primary key for PMM_LISTTYPE.'')';
            EXECUTE IMMEDIATE 'INSERT INTO install_table values ('''||err_msg||''')';
        GOTO bypass_install;
		
		END;
		
		-- CREATE TABLE PMM_TitleList
		BEGIN
			EXECUTE IMMEDIATE 'CREATE TABLE WFS.PMM_TitleList (
										ID_					NUMBER 		NOT NULL,
										NAME					VARCHAR2(50)	 NULL,
										DESCRIPTION 		VARCHAR2(255)	 NULL,
										TitleListTypeId	NUMBER		NOT NULL,
										TitleListStatusId NUMBER			 NULL,
										ProviderId			NUMBER			 NULL,
										ContextId			NUMBER			 NULL,
										PitchDate			DATE				 NULL,
										IsActive				NUMBER(1,0)	DEFAULT(1) NOT NULL,
										CREATEDATE 			TIMESTAMP(6) DEFAULT (SYSTIMESTAMP) NOT NULL,
          							UPDATEDATE 			TIMESTAMP(6) DEFAULT (SYSTIMESTAMP) NOT NULL )
          							TABLESPACE WFS_DATA';
		EXCEPTION 
			WHEN OTHERS THEN
				wk_message := 'ERROR';
				err_msg :=SUBSTR(SQLERRM, 1, 500);
				EXECUTE IMMEDIATE 'INSERT INTO install_table values (''error in installing of application database objects:'||
            	 					'Unable to create table PMM_TitleList.'')';
            EXECUTE IMMEDIATE 'INSERT INTO install_table values ('''||err_msg||''')';
        GOTO bypass_install;
				
		END;

		-- Creating PMM_TitleList Primary Key
		BEGIN
		
		EXECUTE IMMEDIATE 'ALTER TABLE WFS.PMM_TitleList
		ADD ( CONSTRAINT PK_PMM_TitleList
		PRIMARY KEY (ID_)
		NOT DEFERRABLE INITIALLY IMMEDIATE
		USING INDEX
		TABLESPACE WFS_INDEX )';
		
		EXCEPTION 
			WHEN OTHERS THEN
				wk_message := 'ERROR';
				err_msg :=SUBSTR(SQLERRM, 1, 500);
				EXECUTE IMMEDIATE 'INSERT INTO install_table values (''error in installing of application database objects:'||
            	 					'Unable to create primary key for PMM_TitleList.'')';
            EXECUTE IMMEDIATE 'INSERT INTO install_table values ('''||err_msg||''')';
        GOTO bypass_install;
		
		END;
		
		-- CREATE TABLE PMM_Title_TitleListXREF
		BEGIN
			EXECUTE IMMEDIATE 'CREATE TABLE WFS.PMM_Title_TitleListXREF (
										TitleListId	NUMBER NOT NULL,
										TitleId		NUMBER NOT NULL,
										CREATEDATE 	TIMESTAMP(6) DEFAULT (SYSTIMESTAMP) NOT NULL)
          							TABLESPACE WFS_DATA';
		EXCEPTION 
			WHEN OTHERS THEN
				wk_message := 'ERROR';
				err_msg :=SUBSTR(SQLERRM, 1, 500);
				EXECUTE IMMEDIATE 'INSERT INTO install_table values (''error in installing of application database objects:'||
            	 					'Unable to create table PMM_Title_TitleListXREF.'')';
            EXECUTE IMMEDIATE 'INSERT INTO install_table values ('''||err_msg||''')';
        GOTO bypass_install;
				
		END;

		-- Creating PMM_Title_TitleListXREF Primary Key
		BEGIN
		
		EXECUTE IMMEDIATE 'ALTER TABLE WFS.PMM_Title_TitleListXREF
		ADD ( CONSTRAINT PK_PMM_Title_TitleListXREF
		PRIMARY KEY (TitleListId, TitleId)
		NOT DEFERRABLE INITIALLY IMMEDIATE
		USING INDEX
		TABLESPACE WFS_INDEX )';
		
		EXCEPTION 
			WHEN OTHERS THEN
				wk_message := 'ERROR';
				err_msg :=SUBSTR(SQLERRM, 1, 500);
				EXECUTE IMMEDIATE 'INSERT INTO install_table values (''error in installing of application database objects:'||
            	 					'Unable to create primary key for PMM_Title_TitleListXREF.'')';
            EXECUTE IMMEDIATE 'INSERT INTO install_table values ('''||err_msg||''')';
        GOTO bypass_install;
		
		END;
		
		-- CREATE TABLE PMM_ProgressItem
		BEGIN
			EXECUTE IMMEDIATE 'CREATE TABLE WFS.PMM_ProgressItem (
										ID_				NUMBER 		NOT NULL,
										TitleID			NUMBER 		NOT NULL,
										TitleListID		NUMBER 			 NULL,
										ProcessID		NUMBER			 NULL,
										NAME				VARCHAR2(25) NOT NULL,
										DESCRIPTION 	VARCHAR2(25)	 NULL,
										ISSUCCESSFUL	NUMBER(1,0)	DEFAULT(1) NOT NULL,
										ACTIONDATE 		TIMESTAMP(6) NOT NULL,
										CREATEDATE 		TIMESTAMP(6) DEFAULT (SYSTIMESTAMP) NOT NULL,
          							UPDATEDATE 		TIMESTAMP(6) DEFAULT (SYSTIMESTAMP) NOT NULL )
          							TABLESPACE WFS_DATA';
		EXCEPTION 
			WHEN OTHERS THEN
				wk_message := 'ERROR';
				err_msg :=SUBSTR(SQLERRM, 1, 500);
				EXECUTE IMMEDIATE 'INSERT INTO install_table values (''error in installing of application database objects:'||
            	 					'Unable to create table PMM_ProgressItem.'')';
            EXECUTE IMMEDIATE 'INSERT INTO install_table values ('''||err_msg||''')';
        GOTO bypass_install;
				
		END;

		-- Creating PMM_ProgressItem Primary Key
		BEGIN
		
		EXECUTE IMMEDIATE 'ALTER TABLE WFS.PMM_ProgressItem
		ADD ( CONSTRAINT PK_PMM_ProgressItem
		PRIMARY KEY (ID_)
		NOT DEFERRABLE INITIALLY IMMEDIATE
		USING INDEX
		TABLESPACE WFS_INDEX )';
		
		EXCEPTION 
			WHEN OTHERS THEN
				wk_message := 'ERROR';
				err_msg :=SUBSTR(SQLERRM, 1, 500);
				EXECUTE IMMEDIATE 'INSERT INTO install_table values (''error in installing of application database objects:'||
            	 					'Unable to create primary key for PMM_ProgressItem.'')';
            EXECUTE IMMEDIATE 'INSERT INTO install_table values ('''||err_msg||''')';
        GOTO bypass_install;
		
		END;
		
		-- CREATE TABLE PMM_TitleListDetails
		BEGIN
			EXECUTE IMMEDIATE 'CREATE TABLE WFS.PMM_TitleListDetails (
										TitleListID		NUMBER NOT NULL,
										DetailTypeID	NUMBER NOT NULL,
										VALUE				VARCHAR2(255) NULL,
										CREATEDATE 	TIMESTAMP(6) DEFAULT (SYSTIMESTAMP) NOT NULL,
          							UPDATEDATE 	TIMESTAMP(6) DEFAULT (SYSTIMESTAMP) NOT NULL )
          							TABLESPACE WFS_DATA';
		EXCEPTION 
			WHEN OTHERS THEN
				wk_message := 'ERROR';
				err_msg :=SUBSTR(SQLERRM, 1, 500);
				EXECUTE IMMEDIATE 'INSERT INTO install_table values (''error in installing of application database objects:'||
            	 					'Unable to create table PMM_TitleListDetails.'')';
            EXECUTE IMMEDIATE 'INSERT INTO install_table values ('''||err_msg||''')';
        GOTO bypass_install;
				
		END;
		
		-- Creating PMM_TitleListDetails Primary Key
		BEGIN
		
		EXECUTE IMMEDIATE 'ALTER TABLE WFS.PMM_TitleListDetails
		ADD ( CONSTRAINT PK_PMM_TitleListDetails
		PRIMARY KEY (TitleListID, DetailTypeID)
		NOT DEFERRABLE INITIALLY IMMEDIATE
		USING INDEX
		TABLESPACE WFS_INDEX )';
		
		EXCEPTION 
			WHEN OTHERS THEN
				wk_message := 'ERROR';
				err_msg :=SUBSTR(SQLERRM, 1, 500);
				EXECUTE IMMEDIATE 'INSERT INTO install_table values (''error in installing of application database objects:'||
            	 					'Unable to create primary key for PMM_TitleListDetails.'')';
            EXECUTE IMMEDIATE 'INSERT INTO install_table values ('''||err_msg||''')';
        GOTO bypass_install;
		
		END;

		-- CREATE TABLE PMM_TitleListDetailsType
		BEGIN
			EXECUTE IMMEDIATE 'CREATE TABLE WFS.PMM_TitleListDetailsType (
										ID_			NUMBER 		 NOT NULL,
										Name			VARCHAR2(25) NOT NULL,
										CREATEDATE 	TIMESTAMP(6) DEFAULT (SYSTIMESTAMP) NOT NULL,
          							UPDATEDATE 	TIMESTAMP(6) DEFAULT (SYSTIMESTAMP) NOT NULL )
          							TABLESPACE WFS_DATA';
		EXCEPTION 
			WHEN OTHERS THEN
				wk_message := 'ERROR';
				err_msg :=SUBSTR(SQLERRM, 1, 500);
				EXECUTE IMMEDIATE 'INSERT INTO install_table values (''error in installing of application database objects:'||
            	 					'Unable to create table PMM_TitleListDetailsType.'')';
            EXECUTE IMMEDIATE 'INSERT INTO install_table values ('''||err_msg||''')';
        GOTO bypass_install;
				
		END;

		-- Creating PMM_TitleListDetailsType Primary Key
		BEGIN
		
		EXECUTE IMMEDIATE 'ALTER TABLE WFS.PMM_TitleListDetailsType
		ADD ( CONSTRAINT PK_PMM_TitleListDetailsType
		PRIMARY KEY (ID_)
		NOT DEFERRABLE INITIALLY IMMEDIATE
		USING INDEX
		TABLESPACE WFS_INDEX )';
		
		EXCEPTION 
			WHEN OTHERS THEN
				wk_message := 'ERROR';
				err_msg :=SUBSTR(SQLERRM, 1, 500);
				EXECUTE IMMEDIATE 'INSERT INTO install_table values (''error in installing of application database objects:'||
            	 					'Unable to create primary key for PMM_TitleListDetailsType.'')';
            EXECUTE IMMEDIATE 'INSERT INTO install_table values ('''||err_msg||''')';
        GOTO bypass_install;
		
		END;
		
		-- CREATE TABLE PMM_Partner
		BEGIN
			EXECUTE IMMEDIATE 'CREATE TABLE WFS.PMM_Partner (
										ID_			NUMBER 		 NOT NULL,
										NAME			VARCHAR2(25) NOT NULL,
										PartnerType	NUMBER		 NOT NULL,
										ContextId	NUMBER			  NULL,
										ProviderId	VARCHAR2(25) NOT NULL,
										Notes			VARCHAR2(500)	  NULL,
										CREATEDATE 	TIMESTAMP(6) DEFAULT (SYSTIMESTAMP) NOT NULL,
          							UPDATEDATE 	TIMESTAMP(6) DEFAULT (SYSTIMESTAMP) NOT NULL )
          							TABLESPACE WFS_DATA';
		EXCEPTION 
			WHEN OTHERS THEN
				wk_message := 'ERROR';
				err_msg :=SUBSTR(SQLERRM, 1, 500);
				EXECUTE IMMEDIATE 'INSERT INTO install_table values (''error in installing of application database objects:'||
            	 					'Unable to create table PMM_Partner.'')';
            EXECUTE IMMEDIATE 'INSERT INTO install_table values ('''||err_msg||''')';
        GOTO bypass_install;
				
		END;

		-- Creating PMM_Partner Primary Key
		BEGIN
		
		EXECUTE IMMEDIATE 'ALTER TABLE WFS.PMM_Partner
		ADD ( CONSTRAINT PK_PMM_Partner
		PRIMARY KEY (ID_)
		NOT DEFERRABLE INITIALLY IMMEDIATE
		USING INDEX
		TABLESPACE WFS_INDEX )';
		
		EXCEPTION 
			WHEN OTHERS THEN
				wk_message := 'ERROR';
				err_msg :=SUBSTR(SQLERRM, 1, 500);
				EXECUTE IMMEDIATE 'INSERT INTO install_table values (''error in installing of application database objects:'||
            	 					'Unable to create primary key for PMM_Partner.'')';
            EXECUTE IMMEDIATE 'INSERT INTO install_table values ('''||err_msg||''')';
        GOTO bypass_install;
		
		END;
		
		-- CREATE TABLE PMM_PartnerType
		BEGIN
			EXECUTE IMMEDIATE 'CREATE TABLE WFS.PMM_PartnerType (
										ID_			NUMBER 		 NOT NULL,
										NAME			VARCHAR2(50) NOT NULL,
										CREATEDATE 	TIMESTAMP(6) DEFAULT (SYSTIMESTAMP) NOT NULL,
          							UPDATEDATE 	TIMESTAMP(6) DEFAULT (SYSTIMESTAMP) NOT NULL )
          							TABLESPACE WFS_DATA';
		EXCEPTION 
			WHEN OTHERS THEN
				wk_message := 'ERROR';
				err_msg :=SUBSTR(SQLERRM, 1, 500);
				EXECUTE IMMEDIATE 'INSERT INTO install_table values (''error in installing of application database objects:'||
            	 					'Unable to create table PMM_PartnerType.'')';
            EXECUTE IMMEDIATE 'INSERT INTO install_table values ('''||err_msg||''')';
        GOTO bypass_install;
				
		END;

		-- Creating PMM_PartnerType Primary Key
		BEGIN
		
		EXECUTE IMMEDIATE 'ALTER TABLE WFS.PMM_PartnerType
		ADD ( CONSTRAINT PK_PMM_PartnerType
		PRIMARY KEY (ID_)
		NOT DEFERRABLE INITIALLY IMMEDIATE
		USING INDEX
		TABLESPACE WFS_INDEX )';
		
		EXCEPTION 
			WHEN OTHERS THEN
				wk_message := 'ERROR';
				err_msg :=SUBSTR(SQLERRM, 1, 500);
				EXECUTE IMMEDIATE 'INSERT INTO install_table values (''error in installing of application database objects:'||
            	 					'Unable to create primary key for PMM_PartnerType.'')';
            EXECUTE IMMEDIATE 'INSERT INTO install_table values ('''||err_msg||''')';
        GOTO bypass_install;
		
		END;
		
		-- CREATE TABLE PMM_Context
		BEGIN
			EXECUTE IMMEDIATE 'CREATE TABLE WFS.PMM_Context (
										ID_					NUMBER NOT NULL,
										ContainerTypeID	NUMBER NOT NULL,
										CREATEDATE 	TIMESTAMP(6) DEFAULT (SYSTIMESTAMP) NOT NULL,
          							UPDATEDATE 	TIMESTAMP(6) DEFAULT (SYSTIMESTAMP) NOT NULL )
          							TABLESPACE WFS_DATA';
		EXCEPTION 
			WHEN OTHERS THEN
				wk_message := 'ERROR';
				err_msg :=SUBSTR(SQLERRM, 1, 500);
				EXECUTE IMMEDIATE 'INSERT INTO install_table values (''error in installing of application database objects:'||
            	 					'Unable to create table PMM_Context.'')';
            EXECUTE IMMEDIATE 'INSERT INTO install_table values ('''||err_msg||''')';
        GOTO bypass_install;
				
		END;

		-- Creating PMM_Context Primary Key
		BEGIN
		
		EXECUTE IMMEDIATE 'ALTER TABLE WFS.PMM_Context
		ADD ( CONSTRAINT PK_PMM_Context
		PRIMARY KEY (ID_)
		NOT DEFERRABLE INITIALLY IMMEDIATE
		USING INDEX
		TABLESPACE WFS_INDEX )';
		
		EXCEPTION 
			WHEN OTHERS THEN
				wk_message := 'ERROR';
				err_msg :=SUBSTR(SQLERRM, 1, 500);
				EXECUTE IMMEDIATE 'INSERT INTO install_table values (''error in installing of application database objects:'||
            	 					'Unable to create primary key for PMM_Context.'')';
            EXECUTE IMMEDIATE 'INSERT INTO install_table values ('''||err_msg||''')';
        GOTO bypass_install;
		
		END;
		
		-- CREATE TABLE PMM_ContainerType
		BEGIN
			EXECUTE IMMEDIATE 'CREATE TABLE WFS.PMM_ContainerType (
										ID_			NUMBER 		 NOT NULL,
										Name			VARCHAR2(10) NOT NULL,
										CREATEDATE 	TIMESTAMP(6) DEFAULT (SYSTIMESTAMP) NOT NULL,
          							UPDATEDATE 	TIMESTAMP(6) DEFAULT (SYSTIMESTAMP) NOT NULL )
          							TABLESPACE WFS_DATA';
		EXCEPTION 
			WHEN OTHERS THEN
				wk_message := 'ERROR';
				err_msg :=SUBSTR(SQLERRM, 1, 500);
				EXECUTE IMMEDIATE 'INSERT INTO install_table values (''error in installing of application database objects:'||
            	 					'Unable to create table PMM_ContainerType.'')';
            EXECUTE IMMEDIATE 'INSERT INTO install_table values ('''||err_msg||''')';
        GOTO bypass_install;
				
		END;

		-- Creating PMM_ContainerType Primary Key
		BEGIN
		
		EXECUTE IMMEDIATE 'ALTER TABLE WFS.PMM_ContainerType
		ADD ( CONSTRAINT PK_PMM_ContainerType
		PRIMARY KEY (ID_)
		NOT DEFERRABLE INITIALLY IMMEDIATE
		USING INDEX
		TABLESPACE WFS_INDEX )';
		
		EXCEPTION 
			WHEN OTHERS THEN
				wk_message := 'ERROR';
				err_msg :=SUBSTR(SQLERRM, 1, 500);
				EXECUTE IMMEDIATE 'INSERT INTO install_table values (''error in installing of application database objects:'||
            	 					'Unable to create primary key for PMM_ContainerType.'')';
            EXECUTE IMMEDIATE 'INSERT INTO install_table values ('''||err_msg||''')';
        GOTO bypass_install;
		
		END;
		
		-- CREATE TABLE PMM_Contact
		BEGIN
			EXECUTE IMMEDIATE 'CREATE TABLE WFS.PMM_Contact (
										ID_			NUMBER 		 NOT NULL,
										PartnerID	NUMBER 		 NOT NULL,
										FirstName	VARCHAR2(25) 	  NULL,
										LastName		VARCHAR2(25) 	  NULL,
										Email			VARCHAR2(50) NOT NULL,
										CREATEDATE 	TIMESTAMP(6) DEFAULT (SYSTIMESTAMP) NOT NULL,
          							UPDATEDATE 	TIMESTAMP(6) DEFAULT (SYSTIMESTAMP) NOT NULL )
          							TABLESPACE WFS_DATA';
		EXCEPTION 
			WHEN OTHERS THEN
				wk_message := 'ERROR';
				err_msg :=SUBSTR(SQLERRM, 1, 500);
				EXECUTE IMMEDIATE 'INSERT INTO install_table values (''error in installing of application database objects:'||
            	 					'Unable to create table PMM_Contact.'')';
            EXECUTE IMMEDIATE 'INSERT INTO install_table values ('''||err_msg||''')';
        GOTO bypass_install;
				
		END;

		-- Creating PMM_Contact Primary Key
		BEGIN
		
		EXECUTE IMMEDIATE 'ALTER TABLE WFS.PMM_Contact
		ADD ( CONSTRAINT PK_PMM_Contact
		PRIMARY KEY (ID_)
		NOT DEFERRABLE INITIALLY IMMEDIATE
		USING INDEX
		TABLESPACE WFS_INDEX )';
		
		EXCEPTION 
			WHEN OTHERS THEN
				wk_message := 'ERROR';
				err_msg :=SUBSTR(SQLERRM, 1, 500);
				EXECUTE IMMEDIATE 'INSERT INTO install_table values (''error in installing of application database objects:'||
            	 					'Unable to create primary key for PMM_Contact.'')';
            EXECUTE IMMEDIATE 'INSERT INTO install_table values ('''||err_msg||''')';
        GOTO bypass_install;
		
		END;
		
		-- CREATE TABLE PMM_RuleType
		BEGIN
			EXECUTE IMMEDIATE 'CREATE TABLE WFS.PMM_RuleType (
										ID_							NUMBER 			NOT NULL,
										NAME							VARCHAR2(50)		 NULL,
										TitlesAssociated 			NUMBER(1,0) DEFAULT(0) 	NOT NULL,
										CREATEDATE 	TIMESTAMP(6) DEFAULT (SYSTIMESTAMP) NOT NULL,
          							UPDATEDATE 	TIMESTAMP(6) DEFAULT (SYSTIMESTAMP) NOT NULL )
          							TABLESPACE WFS_DATA';
		EXCEPTION 
			WHEN OTHERS THEN
				wk_message := 'ERROR';
				err_msg :=SUBSTR(SQLERRM, 1, 500);
				EXECUTE IMMEDIATE 'INSERT INTO install_table values (''error in installing of application database objects:'||
            	 					'Unable to create table PMM_RuleType.'')';
            EXECUTE IMMEDIATE 'INSERT INTO install_table values ('''||err_msg||''')';
        GOTO bypass_install;
				
		END;

		-- Creating PMM_RuleType Primary Key
		BEGIN
		
		EXECUTE IMMEDIATE 'ALTER TABLE WFS.PMM_RuleType
		ADD ( CONSTRAINT PK_PMM_RuleType
		PRIMARY KEY (ID_)
		NOT DEFERRABLE INITIALLY IMMEDIATE
		USING INDEX
		TABLESPACE WFS_INDEX )';
		
		EXCEPTION 
			WHEN OTHERS THEN
				wk_message := 'ERROR';
				err_msg :=SUBSTR(SQLERRM, 1, 500);
				EXECUTE IMMEDIATE 'INSERT INTO install_table values (''error in installing of application database objects:'||
            	 					'Unable to create primary key for PMM_RuleType.'')';
            EXECUTE IMMEDIATE 'INSERT INTO install_table values ('''||err_msg||''')';
        GOTO bypass_install;
		
		END;
		
		-- CREATE TABLE PMM_Rule
		BEGIN
			EXECUTE IMMEDIATE 'CREATE TABLE WFS.PMM_Rule (
										ID_					NUMBER 		NOT NULL,
										RuleTypeId			NUMBER		NOT NULL,
										StartDate			TIMESTAMP 		 NULL,
										EndDate				TIMESTAMP 		 NULL,
										CREATEDATE 	TIMESTAMP(6) DEFAULT (SYSTIMESTAMP) NOT NULL,
          							UPDATEDATE 	TIMESTAMP(6) DEFAULT (SYSTIMESTAMP) NOT NULL )
          							TABLESPACE WFS_DATA';
		EXCEPTION 
			WHEN OTHERS THEN
				wk_message := 'ERROR';
				err_msg :=SUBSTR(SQLERRM, 1, 500);
				EXECUTE IMMEDIATE 'INSERT INTO install_table values (''error in installing of application database objects:'||
            	 					'Unable to create table PMM_Rule.'')';
            EXECUTE IMMEDIATE 'INSERT INTO install_table values ('''||err_msg||''')';
        GOTO bypass_install;
				
		END;

		-- Creating PMM_Rule Primary Key
		BEGIN
		
		EXECUTE IMMEDIATE 'ALTER TABLE WFS.PMM_Rule
		ADD ( CONSTRAINT PK_PMM_Rule
		PRIMARY KEY (ID_)
		NOT DEFERRABLE INITIALLY IMMEDIATE
		USING INDEX
		TABLESPACE WFS_INDEX )';
		
		EXCEPTION 
			WHEN OTHERS THEN
				wk_message := 'ERROR';
				err_msg :=SUBSTR(SQLERRM, 1, 500);
				EXECUTE IMMEDIATE 'INSERT INTO install_table values (''error in installing of application database objects:'||
            	 					'Unable to create primary key for PMM_Rule.'')';
            EXECUTE IMMEDIATE 'INSERT INTO install_table values ('''||err_msg||''')';
        GOTO bypass_install;
		
		END;
		
		-- CREATE TABLE PMM_RuleParameter
		BEGIN
			EXECUTE IMMEDIATE 'CREATE TABLE WFS.PMM_RuleParameter (
										ID_			NUMBER 			NOT NULL,
										RuleID		NUMBER			NOT NULL,
										Value			varchar2(100)	NOT NULL,
										ORDER_		NUMBER			NOT NULL,
										CREATEDATE 	TIMESTAMP(6) DEFAULT (SYSTIMESTAMP) NOT NULL,
          							UPDATEDATE 	TIMESTAMP(6) DEFAULT (SYSTIMESTAMP) NOT NULL )
          							TABLESPACE WFS_DATA';
		EXCEPTION 
			WHEN OTHERS THEN
				wk_message := 'ERROR';
				err_msg :=SUBSTR(SQLERRM, 1, 500);
				EXECUTE IMMEDIATE 'INSERT INTO install_table values (''error in installing of application database objects:'||
            	 					'Unable to create table PMM_RuleParameter.'')';
            EXECUTE IMMEDIATE 'INSERT INTO install_table values ('''||err_msg||''')';
        GOTO bypass_install;
				
		END;

		-- Creating PMM_RuleParameter Primary Key
		BEGIN
		
		EXECUTE IMMEDIATE 'ALTER TABLE WFS.PMM_RuleParameter
		ADD ( CONSTRAINT PK_PMM_RuleParameter
		PRIMARY KEY (ID_)
		NOT DEFERRABLE INITIALLY IMMEDIATE
		USING INDEX
		TABLESPACE WFS_INDEX )';
		
		EXCEPTION 
			WHEN OTHERS THEN
				wk_message := 'ERROR';
				err_msg :=SUBSTR(SQLERRM, 1, 500);
				EXECUTE IMMEDIATE 'INSERT INTO install_table values (''error in installing of application database objects:'||
            	 					'Unable to create primary key for PMM_RuleParameter.'')';
            EXECUTE IMMEDIATE 'INSERT INTO install_table values ('''||err_msg||''')';
        GOTO bypass_install;
		
		END;
		
		-- CREATE TABLE PMM_Service
		BEGIN
			EXECUTE IMMEDIATE 'CREATE TABLE WFS.PMM_Service (
										ID_			NUMBER 		 NOT NULL,
										Name			varchar2(25) NOT NULL,
										Description varchar2(255)    NULL,
										ContextID	NUMBER			  NULL,
										CREATEDATE 	TIMESTAMP(6) DEFAULT (SYSTIMESTAMP) NOT NULL,
          							UPDATEDATE 	TIMESTAMP(6) DEFAULT (SYSTIMESTAMP) NOT NULL )
          							TABLESPACE WFS_DATA';
		EXCEPTION 
			WHEN OTHERS THEN
				wk_message := 'ERROR';
				err_msg :=SUBSTR(SQLERRM, 1, 500);
				EXECUTE IMMEDIATE 'INSERT INTO install_table values (''error in installing of application database objects:'||
            	 					'Unable to create table PMM_Service.'')';
            EXECUTE IMMEDIATE 'INSERT INTO install_table values ('''||err_msg||''')';
        GOTO bypass_install;
				
		END;

		-- Creating PMM_Service Primary Key
		BEGIN
		
		EXECUTE IMMEDIATE 'ALTER TABLE WFS.PMM_Service
		ADD ( CONSTRAINT PK_PMM_Service
		PRIMARY KEY (ID_)
		NOT DEFERRABLE INITIALLY IMMEDIATE
		USING INDEX
		TABLESPACE WFS_INDEX )';
		
		EXCEPTION 
			WHEN OTHERS THEN
				wk_message := 'ERROR';
				err_msg :=SUBSTR(SQLERRM, 1, 500);
				EXECUTE IMMEDIATE 'INSERT INTO install_table values (''error in installing of application database objects:'||
            	 					'Unable to create primary key for PMM_Service.'')';
            EXECUTE IMMEDIATE 'INSERT INTO install_table values ('''||err_msg||''')';
        GOTO bypass_install;
		
		END;
		
		-- CREATE TABLE PMM_Service_PartnerXREF
		BEGIN
			EXECUTE IMMEDIATE 'CREATE TABLE WFS.PMM_Service_PartnerXREF (
										PartnerID	NUMBER 		NOT NULL,
										ServiceID	NUMBER 		NOT NULL,
										CREATEDATE 	TIMESTAMP(6) DEFAULT (SYSTIMESTAMP) NOT NULL )
          							TABLESPACE WFS_DATA';
		EXCEPTION 
			WHEN OTHERS THEN
				wk_message := 'ERROR';
				err_msg :=SUBSTR(SQLERRM, 1, 500);
				EXECUTE IMMEDIATE 'INSERT INTO install_table values (''error in installing of application database objects:'||
            	 					'Unable to create table PMM_Service_PartnerXREF.'')';
            EXECUTE IMMEDIATE 'INSERT INTO install_table values ('''||err_msg||''')';
        GOTO bypass_install;
				
		END;

		-- Creating PMM_Service_PartnerXREF Primary Key
		BEGIN
		
		EXECUTE IMMEDIATE 'ALTER TABLE WFS.PMM_Service_PartnerXREF
		ADD ( CONSTRAINT PK_PMM_Service_PartnerXREF
		PRIMARY KEY (ServiceID, PartnerID)
		NOT DEFERRABLE INITIALLY IMMEDIATE
		USING INDEX
		TABLESPACE WFS_INDEX )';
		
		EXCEPTION 
			WHEN OTHERS THEN
				wk_message := 'ERROR';
				err_msg :=SUBSTR(SQLERRM, 1, 500);
				EXECUTE IMMEDIATE 'INSERT INTO install_table values (''error in installing of application database objects:'||
            	 					'Unable to create primary key for PMM_Service_PartnerXREF.'')';
            EXECUTE IMMEDIATE 'INSERT INTO install_table values ('''||err_msg||''')';
        GOTO bypass_install;
		
		END;
		
		-- CREATE TABLE PMM_PitchFrequency
		BEGIN
			EXECUTE IMMEDIATE 'CREATE TABLE WFS.PMM_PitchFrequency (
										ID_							NUMBER 		NOT NULL,
										DistributionPartnerId	NUMBER		NOT NULL,
										SourcePartnerId			NUMBER			 NULL,
										WeeksBetweenPitch			NUMBER DEFAULT(1) NOT NULL,
										PitchDay						NUMBER DEFAULT(0) NOT NULL,
										CREATEDATE 	TIMESTAMP(6) DEFAULT (SYSTIMESTAMP) NOT NULL,
          							UPDATEDATE 	TIMESTAMP(6) DEFAULT (SYSTIMESTAMP) NOT NULL,
          							CONSTRAINT CK_PMM_PitchFreq_Unique UNIQUE (DistributionPartnerId,SourcePartnerId, PitchDay),
          							CONSTRAINT CK_PMM_PitchFreq_WBP CHECK (WeeksBetweenPitch >= 0),
          							CONSTRAINT CK_PMM_PitchFreq_PD CHECK (PitchDay >=0 and PitchDay < 7))
          							TABLESPACE WFS_DATA';
		EXCEPTION 
			WHEN OTHERS THEN
				wk_message := 'ERROR';
				err_msg :=SUBSTR(SQLERRM, 1, 500);
				EXECUTE IMMEDIATE 'INSERT INTO install_table values (''error in installing of application database objects:'||
            	 					'Unable to create table PMM_PitchFrequency.'')';
            EXECUTE IMMEDIATE 'INSERT INTO install_table values ('''||err_msg||''')';
        GOTO bypass_install;
				
		END;

		-- Creating PMM_PitchFrequency Primary Key
		BEGIN
		
		EXECUTE IMMEDIATE 'ALTER TABLE WFS.PMM_PitchFrequency
		ADD ( CONSTRAINT PK_PMM_PitchFrequency
		PRIMARY KEY (ID_)
		NOT DEFERRABLE INITIALLY IMMEDIATE
		USING INDEX
		TABLESPACE WFS_INDEX )';
		
		EXCEPTION 
			WHEN OTHERS THEN
				wk_message := 'ERROR';
				err_msg :=SUBSTR(SQLERRM, 1, 500);
				EXECUTE IMMEDIATE 'INSERT INTO install_table values (''error in installing of application database objects:'||
            	 					'Unable to create primary key for PMM_PitchFrequency.'')';
            EXECUTE IMMEDIATE 'INSERT INTO install_table values ('''||err_msg||''')';
        GOTO bypass_install;
		
		END;
		
		-- CREATE TABLE PMM_Job
		BEGIN
			EXECUTE IMMEDIATE 'CREATE TABLE WFS.PMM_Job (
										ID_						NUMBER 				NOT NULL,
										ProcessPriorityID		NUMBER 				NOT NULL,
										Name						VARCHAR2(25) 		NOT NULL,
										ContextID				NUMBER 				NOT NULL,
										TEMPLATENAME			VARCHAR2(255) 	NOT NULL,
										RuleID					NUMBER					 NULL,
										CREATEDATE 	TIMESTAMP(6) DEFAULT (SYSTIMESTAMP) NOT NULL,
          							UPDATEDATE 	TIMESTAMP(6) DEFAULT (SYSTIMESTAMP) NOT NULL )
          							TABLESPACE WFS_DATA';
		EXCEPTION 
			WHEN OTHERS THEN
				wk_message := 'ERROR';
				err_msg :=SUBSTR(SQLERRM, 1, 500);
				EXECUTE IMMEDIATE 'INSERT INTO install_table values (''error in installing of application database objects:'||
            	 					'Unable to create table PMM_Job.'')';
            EXECUTE IMMEDIATE 'INSERT INTO install_table values ('''||err_msg||''')';
        GOTO bypass_install;
				
		END;

		-- Creating PMM_Job Primary Key
		BEGIN
		
		EXECUTE IMMEDIATE 'ALTER TABLE WFS.PMM_Job
		ADD ( CONSTRAINT PK_PMM_Job
		PRIMARY KEY (ID_)
		NOT DEFERRABLE INITIALLY IMMEDIATE
		USING INDEX
		TABLESPACE WFS_INDEX )';
		
		EXCEPTION 
			WHEN OTHERS THEN
				wk_message := 'ERROR';
				err_msg :=SUBSTR(SQLERRM, 1, 500);
				EXECUTE IMMEDIATE 'INSERT INTO install_table values (''error in installing of application database objects:'||
            	 					'Unable to create primary key for PMM_Job.'')';
            EXECUTE IMMEDIATE 'INSERT INTO install_table values ('''||err_msg||''')';
        GOTO bypass_install;
		
		END;
		
		-- CREATE TABLE PMM_WatchFolderConfiguration
		BEGIN
			EXECUTE IMMEDIATE 'CREATE TABLE WFS.PMM_WatchFolderConfiguration (
										ID_					NUMBER	 		NOT NULL,
										NAME					VARCHAR2(25)	NOT NULL,
										ResourceID			NUMBER	 			 NULL,
										Location				VARCHAR2(25)		 NULL,
										FileTypes			VARCHAR2(25)		 NULL,
										ProcessingClass	VARCHAR2(25)		 NULL,
										Events				VARCHAR2(25)		 NULL,
										ThreadCount			NUMBER	 			 NULL,
										Frequency			NUMBER	 			 NULL,
										ContextID			NUMBER	 			 NULL,
										CREATEDATE 	TIMESTAMP(6) DEFAULT (SYSTIMESTAMP) NOT NULL,
          							UPDATEDATE 	TIMESTAMP(6) DEFAULT (SYSTIMESTAMP) NOT NULL )
          							TABLESPACE WFS_DATA';
		EXCEPTION 
			WHEN OTHERS THEN
				wk_message := 'ERROR';
				err_msg :=SUBSTR(SQLERRM, 1, 500);
				EXECUTE IMMEDIATE 'INSERT INTO install_table values (''error in installing of application database objects:'||
            	 					'Unable to create table PMM_WatchFolderConfiguration.'')';
            EXECUTE IMMEDIATE 'INSERT INTO install_table values ('''||err_msg||''')';
        GOTO bypass_install;
				
		END;

		-- Creating PMM_WatchFolderConfiguration Primary Key
		BEGIN
		
		EXECUTE IMMEDIATE 'ALTER TABLE WFS.PMM_WatchFolderConfiguration
		ADD ( CONSTRAINT PK_PMM_WatchFolderConfig
		PRIMARY KEY (ID_)
		NOT DEFERRABLE INITIALLY IMMEDIATE
		USING INDEX
		TABLESPACE WFS_INDEX )';
		
		EXCEPTION 
			WHEN OTHERS THEN
				wk_message := 'ERROR';
				err_msg :=SUBSTR(SQLERRM, 1, 500);
				EXECUTE IMMEDIATE 'INSERT INTO install_table values (''error in installing of application database objects:'||
            	 					'Unable to create primary key for PMM_WatchFolderConfiguration.'')';
            EXECUTE IMMEDIATE 'INSERT INTO install_table values ('''||err_msg||''')';
        GOTO bypass_install;
		
		END;
		
		-- CREATE TABLE PMM_JobParameter
		BEGIN
			EXECUTE IMMEDIATE 'CREATE TABLE WFS.PMM_JobParameter (
										ID_			NUMBER 			NOT NULL,
										JobId			NUMBER 			NOT NULL,
										Name			VARCHAR2(50)	NOT NULL,
										Value			VARCHAR2(255)		 NULL,
										CREATEDATE 	TIMESTAMP(6) DEFAULT (SYSTIMESTAMP) NOT NULL,
          							UPDATEDATE 	TIMESTAMP(6) DEFAULT (SYSTIMESTAMP) NOT NULL )
          							TABLESPACE WFS_DATA';
		EXCEPTION 
			WHEN OTHERS THEN
				wk_message := 'ERROR';
				err_msg :=SUBSTR(SQLERRM, 1, 500);
				EXECUTE IMMEDIATE 'INSERT INTO install_table values (''error in installing of application database objects:'||
            	 					'Unable to create table PMM_JobParameter.'')';
            EXECUTE IMMEDIATE 'INSERT INTO install_table values ('''||err_msg||''')';
        GOTO bypass_install;
				
		END;

		-- Creating PMM_JobParameter Primary Key
		BEGIN
		
		EXECUTE IMMEDIATE 'ALTER TABLE WFS.PMM_JobParameter
		ADD ( CONSTRAINT PK_PMM_JobParameter
		PRIMARY KEY (ID_)
		NOT DEFERRABLE INITIALLY IMMEDIATE
		USING INDEX
		TABLESPACE WFS_INDEX )';
		
		EXCEPTION 
			WHEN OTHERS THEN
				wk_message := 'ERROR';
				err_msg :=SUBSTR(SQLERRM, 1, 500);
				EXECUTE IMMEDIATE 'INSERT INTO install_table values (''error in installing of application database objects:'||
            	 					'Unable to create primary key for PMM_JobParameter.'')';
            EXECUTE IMMEDIATE 'INSERT INTO install_table values ('''||err_msg||''')';
        GOTO bypass_install;
		
		END;
		
		-- CREATE TABLE PMM_RULETYPEPARAMETERDATATYPE
		BEGIN
			EXECUTE IMMEDIATE 'CREATE TABLE WFS.PMM_RULETYPEPARAMETERDATATYPE (
										ID_			NUMBER 		NOT NULL,
										Value			VARCHAR2(255)   NULL,
										CREATEDATE 	TIMESTAMP(6) DEFAULT (SYSTIMESTAMP) NOT NULL,
          							UPDATEDATE 	TIMESTAMP(6) DEFAULT (SYSTIMESTAMP) NOT NULL )
          							TABLESPACE WFS_DATA';
		EXCEPTION 
			WHEN OTHERS THEN
				wk_message := 'ERROR';
				err_msg :=SUBSTR(SQLERRM, 1, 500);
				EXECUTE IMMEDIATE 'INSERT INTO install_table values (''error in installing of application database objects:'||
            	 					'Unable to create table PMM_RULETYPEPARAMETERDATATYPE.'')';
            EXECUTE IMMEDIATE 'INSERT INTO install_table values ('''||err_msg||''')';
        GOTO bypass_install;
				
		END;

		-- Creating PMM_RULETYPEPARAMETERDATATYPE Primary Key
		BEGIN
		
		EXECUTE IMMEDIATE 'ALTER TABLE WFS.PMM_RULETYPEPARAMETERDATATYPE
		ADD ( CONSTRAINT PK_PMM_RULETYPEPARAMDATATYPE
		PRIMARY KEY (ID_)
		NOT DEFERRABLE INITIALLY IMMEDIATE
		USING INDEX
		TABLESPACE WFS_INDEX )';
		
		EXCEPTION 
			WHEN OTHERS THEN
				wk_message := 'ERROR';
				err_msg :=SUBSTR(SQLERRM, 1, 500);
				EXECUTE IMMEDIATE 'INSERT INTO install_table values (''error in installing of application database objects:'||
            	 					'Unable to create primary key for PMM_RULETYPEPARAMETERDATATYPE.'')';
            EXECUTE IMMEDIATE 'INSERT INTO install_table values ('''||err_msg||''')';
        GOTO bypass_install;
		
		END;
		
		-- CREATE TABLE PMM_RuleTypeParameter
		BEGIN
			EXECUTE IMMEDIATE 'CREATE TABLE WFS.PMM_RuleTypeParameter (
										ID_			NUMBER 		NOT NULL,
										NAME 			VARCHAR2(50)    NULL,
										RULETYPEID	NUMBER 		NOT NULL,
										Order_		NUMBER		NOT NULL,
										ISREQUIRED	NUMBER(1,0)	NOT NULL,
										DataTypeID	NUMBER		NOT NULL,
										CREATEDATE 	TIMESTAMP(6) DEFAULT (SYSTIMESTAMP) NOT NULL,
          							UPDATEDATE 	TIMESTAMP(6) DEFAULT (SYSTIMESTAMP) NOT NULL )
          							TABLESPACE WFS_DATA';
		EXCEPTION 
			WHEN OTHERS THEN
				wk_message := 'ERROR';
				err_msg :=SUBSTR(SQLERRM, 1, 500);
				EXECUTE IMMEDIATE 'INSERT INTO install_table values (''error in installing of application database objects:'||
            	 					'Unable to create table PMM_RuleTypeParameter.'')';
            EXECUTE IMMEDIATE 'INSERT INTO install_table values ('''||err_msg||''')';
        GOTO bypass_install;
				
		END;

		-- Creating PMM_RuleTypeParameter Primary Key
		BEGIN
		
		EXECUTE IMMEDIATE 'ALTER TABLE WFS.PMM_RuleTypeParameter
		ADD ( CONSTRAINT PK_PMM_RuleTypeContent
		PRIMARY KEY (ID_)
		NOT DEFERRABLE INITIALLY IMMEDIATE
		USING INDEX
		TABLESPACE WFS_INDEX )';
		
		EXCEPTION 
			WHEN OTHERS THEN
				wk_message := 'ERROR';
				err_msg :=SUBSTR(SQLERRM, 1, 500);
				EXECUTE IMMEDIATE 'INSERT INTO install_table values (''error in installing of application database objects:'||
            	 					'Unable to create primary key for PMM_RuleTypeParameter.'')';
            EXECUTE IMMEDIATE 'INSERT INTO install_table values ('''||err_msg||''')';
        GOTO bypass_install;
		
		END;
		
		-- CREATE TABLE PMM_PROPERTIES
		BEGIN
			EXECUTE IMMEDIATE 'CREATE TABLE WFS.PMM_PROPERTIES (
										ID_			NUMBER 		NOT NULL,
										Name			VARCHAR2(32)	 NULL,
										Value       VARCHAR2(32)	 NULL,
										TitleId		NUMBER 		NOT NULL,
										TitleListId NUMBER 			 NULL,
										ContextId	NUMBER 			 NULL,
										CREATEDATE 	TIMESTAMP(6) DEFAULT (SYSTIMESTAMP) NOT NULL,
          							UPDATEDATE 	TIMESTAMP(6) DEFAULT (SYSTIMESTAMP) NOT NULL )
          							TABLESPACE WFS_DATA';
		EXCEPTION 
			WHEN OTHERS THEN
				wk_message := 'ERROR';
				err_msg :=SUBSTR(SQLERRM, 1, 500);
				EXECUTE IMMEDIATE 'INSERT INTO install_table values (''error in installing of application database objects:'||
            	 					'Unable to create table PMM_PROPERTIES.'')';
            EXECUTE IMMEDIATE 'INSERT INTO install_table values ('||err_msg||')';
        GOTO bypass_install;
				
		END;

		-- Creating PMM_PROPERTIES Primary Key
		BEGIN
		
		EXECUTE IMMEDIATE 'ALTER TABLE WFS.PMM_PROPERTIES
		ADD ( CONSTRAINT PK_PMM_PROPERTIES
		PRIMARY KEY (ID_)
		NOT DEFERRABLE INITIALLY IMMEDIATE
		USING INDEX
		TABLESPACE WFS_INDEX )';
		
		EXCEPTION 
			WHEN OTHERS THEN
				wk_message := 'ERROR';
				err_msg :=SUBSTR(SQLERRM, 1, 500);
				EXECUTE IMMEDIATE 'INSERT INTO install_table values (''error in installing of application database objects:'||
            	 					'Unable to create primary key for PMM_PROPERTIES.'')';
            EXECUTE IMMEDIATE 'INSERT INTO install_table values ('||err_msg||')';
        GOTO bypass_install;
		
		END;
		
		/*------------------------------------------------------------------
								INSERT PMM Default Table Values
		------------------------------------------------------------------*/
		
		--Inserts for PMM_PartnerType
		BEGIN
			EXECUTE IMMEDIATE 'INSERT INTO WFS.PMM_PartnerType (ID_,Name,CreateDate, UpdateDate)
									 VALUES(0,''SELF'',TO_DATE(''16/04/2008 11:00:00 AM'',''DD/MM/YYYY HH12:MI:SS PM''), TO_DATE(''16/06/2008 11:00:00 AM'',''DD/MM/YYYY HH12:MI:SS PM''))';
			EXECUTE IMMEDIATE 'INSERT INTO WFS.PMM_PartnerType (ID_,Name,CreateDate, UpdateDate)
									 VALUES(1,''DISTRIBUTION'',TO_DATE(''16/04/2008 11:00:00 AM'',''DD/MM/YYYY HH12:MI:SS PM''), TO_DATE(''16/06/2008 11:00:00 AM'',''DD/MM/YYYY HH12:MI:SS PM''))';
			EXECUTE IMMEDIATE 'INSERT INTO WFS.PMM_PartnerType (ID_,Name,CreateDate, UpdateDate)
									 VALUES(2,''SOURCE'',TO_DATE(''16/04/2008 11:00:00 AM'',''DD/MM/YYYY HH12:MI:SS PM''), TO_DATE(''16/06/2008 11:00:00 AM'',''DD/MM/YYYY HH12:MI:SS PM''))';
		EXCEPTION 
			WHEN OTHERS THEN
				wk_message := 'ERROR';
				err_msg :=SUBSTR(SQLERRM, 1, 500);
				EXECUTE IMMEDIATE 'INSERT INTO install_table values (''error in installing of application database objects:'||
            	 					'Unable to insert into PMM_PartnerType.'')';
            EXECUTE IMMEDIATE 'INSERT INTO install_table values ('''||err_msg||''')';
        GOTO bypass_install;
		
		END;
		
		--Inserts for PMM_ContainerType
		BEGIN
			EXECUTE IMMEDIATE 'INSERT INTO WFS.PMM_ContainerType (ID_,Name,CreateDate, UpdateDate)
									 VALUES(1,''PARTNER'',TO_DATE(''16/04/2008 11:00:00 AM'',''DD/MM/YYYY HH12:MI:SS PM''), TO_DATE(''16/04/2008 11:00:00 AM'',''DD/MM/YYYY HH12:MI:SS PM''))';
			EXECUTE IMMEDIATE 'INSERT INTO WFS.PMM_ContainerType (ID_,Name,CreateDate, UpdateDate)
									 VALUES(2,''SERVICE'',TO_DATE(''16/04/2008 11:00:00 AM'',''DD/MM/YYYY HH12:MI:SS PM''), TO_DATE(''16/04/2008 11:00:00 AM'',''DD/MM/YYYY HH12:MI:SS PM''))';
		EXCEPTION 
			WHEN OTHERS THEN
				wk_message := 'ERROR';
				err_msg :=SUBSTR(SQLERRM, 1, 500);
				EXECUTE IMMEDIATE 'INSERT INTO install_table values (''error in installing of application database objects:'||
            	 					'Unable to insert into PMM_ContainerType.'')';
            EXECUTE IMMEDIATE 'INSERT INTO install_table values ('''||err_msg||''')';
        GOTO bypass_install;
		
		END;

		--Inserts for PMM_RuleType
		BEGIN
			EXECUTE IMMEDIATE 'INSERT INTO WFS.PMM_RuleType (ID_, NAME, TitlesAssociated, CreateDate, UpdateDate)
									 VALUES(1,''NDaysFromMetadata'',1,TO_DATE(''03/06/2008 12:00:00 PM'',''DD/MM/YYYY HH12:MI:SS PM''), TO_DATE(''03/06/2008 12:00:00 PM'',''DD/MM/YYYY HH12:MI:SS PM''))';
		EXCEPTION 
			WHEN OTHERS THEN
				wk_message := 'ERROR';
				err_msg :=SUBSTR(SQLERRM, 1, 500);
				EXECUTE IMMEDIATE 'INSERT INTO install_table values (''error in installing of application database objects:'||
            	 					'Unable to insert into PMM_RuleType.'')';
            EXECUTE IMMEDIATE 'INSERT INTO install_table values ('''||err_msg||''')';
        GOTO bypass_install;
		
		END;
		
		--Inserts for PMM_TITLESTATUS
		BEGIN
			EXECUTE IMMEDIATE 'INSERT INTO WFS.PMM_TITLESTATUS (ID_,Description,CreateDate, UpdateDate)
									 VALUES(0,''NEW'',TO_DATE(''16/04/2008 11:00:00 AM'',''DD/MM/YYYY HH12:MI:SS PM''), TO_DATE(''16/04/2008 11:00:00 AM'',''DD/MM/YYYY HH12:MI:SS PM''))';
			EXECUTE IMMEDIATE 'INSERT INTO WFS.PMM_TITLESTATUS (ID_,Description,CreateDate, UpdateDate)
									 VALUES(1,''READY'',TO_DATE(''16/04/2008 11:00:00 AM'',''DD/MM/YYYY HH12:MI:SS PM''), TO_DATE(''16/04/2008 11:00:00 AM'',''DD/MM/YYYY HH12:MI:SS PM''))';
			EXECUTE IMMEDIATE 'INSERT INTO WFS.PMM_TITLESTATUS (ID_,Description,CreateDate, UpdateDate)
									 VALUES(2,''APPROVED'',TO_DATE(''16/04/2008 11:00:00 AM'',''DD/MM/YYYY HH12:MI:SS PM''), TO_DATE(''16/04/2008 11:00:00 AM'',''DD/MM/YYYY HH12:MI:SS PM''))';
			EXECUTE IMMEDIATE 'INSERT INTO WFS.PMM_TITLESTATUS (ID_,Description,CreateDate, UpdateDate)
									 VALUES(3,''RETIRED'',TO_DATE(''16/04/2008 11:00:00 AM'',''DD/MM/YYYY HH12:MI:SS PM''), TO_DATE(''16/04/2008 11:00:00 AM'',''DD/MM/YYYY HH12:MI:SS PM''))';
		EXCEPTION 
			WHEN OTHERS THEN
				wk_message := 'ERROR';
				err_msg :=SUBSTR(SQLERRM, 1, 500);
				EXECUTE IMMEDIATE 'INSERT INTO install_table values (''error in installing of application database objects:'||
            	 					'Unable to insert into PMM_TITLESTATUS.'')';
            EXECUTE IMMEDIATE 'INSERT INTO install_table values ('''||err_msg||''')';
        GOTO bypass_install;
		
		END;
		
		--Inserts for PMM_TITLELISTSTATUS
		BEGIN
			EXECUTE IMMEDIATE 'INSERT INTO WFS.PMM_TITLELISTSTATUS (ID_,Description,CreateDate, UpdateDate)
									 VALUES(0,''DRAFT'',TO_DATE(''16/04/2008 11:00:00 AM'',''DD/MM/YYYY HH12:MI:SS PM''), TO_DATE(''16/04/2008 11:00:00 AM'',''DD/MM/YYYY HH12:MI:SS PM''))';
			EXECUTE IMMEDIATE 'INSERT INTO WFS.PMM_TITLELISTSTATUS (ID_,Description,CreateDate, UpdateDate)
									 VALUES(1,''READY'',TO_DATE(''16/04/2008 11:00:00 AM'',''DD/MM/YYYY HH12:MI:SS PM''), TO_DATE(''16/04/2008 11:00:00 AM'',''DD/MM/YYYY HH12:MI:SS PM''))';
			EXECUTE IMMEDIATE 'INSERT INTO WFS.PMM_TITLELISTSTATUS (ID_,Description,CreateDate, UpdateDate)
									 VALUES(2,''APPROVED'',TO_DATE(''16/04/2008 11:00:00 AM'',''DD/MM/YYYY HH12:MI:SS PM''), TO_DATE(''16/04/2008 11:00:00 AM'',''DD/MM/YYYY HH12:MI:SS PM''))';
		EXCEPTION 
			WHEN OTHERS THEN
				wk_message := 'ERROR';
				err_msg :=SUBSTR(SQLERRM, 1, 500);
				EXECUTE IMMEDIATE 'INSERT INTO install_table values (''error in installing of application database objects:'||
            	 					'Unable to insert into PMM_TITLELISTSTATUS.'')';
            EXECUTE IMMEDIATE 'INSERT INTO install_table values ('''||err_msg||''')';
        GOTO bypass_install;
		
		END;
		
		--Inserts for PMM_LISTTYPE
		BEGIN
			EXECUTE IMMEDIATE 'INSERT INTO WFS.PMM_LISTTYPE (ID_,Description,CreateDate, UpdateDate)
									 VALUES(1,''Pitch Schedule'',TO_DATE(''16/04/2008 11:00:00 AM'',''DD/MM/YYYY HH12:MI:SS PM''), TO_DATE(''16/04/2008 11:00:00 AM'',''DD/MM/YYYY HH12:MI:SS PM''))';
			EXECUTE IMMEDIATE 'INSERT INTO WFS.PMM_LISTTYPE (ID_,Description,CreateDate, UpdateDate)
									 VALUES(2,''Program List'',TO_DATE(''16/04/2008 11:00:00 AM'',''DD/MM/YYYY HH12:MI:SS PM''), TO_DATE(''16/04/2008 11:00:00 AM'',''DD/MM/YYYY HH12:MI:SS PM''))';
			EXECUTE IMMEDIATE 'INSERT INTO WFS.PMM_LISTTYPE (ID_,Description,CreateDate, UpdateDate)
									 VALUES(3,''Planner'',TO_DATE(''09/06/2008 11:00:00 AM'',''DD/MM/YYYY HH12:MI:SS PM''), TO_DATE(''09/06/2008 11:00:00 AM'',''DD/MM/YYYY HH12:MI:SS PM''))';
		EXCEPTION 
			WHEN OTHERS THEN
				wk_message := 'ERROR';
				err_msg :=SUBSTR(SQLERRM, 1, 500);
				EXECUTE IMMEDIATE 'INSERT INTO install_table values (''error in installing of application database objects:'||
            	 					'Unable to insert into PMM_LISTTYPE.'')';
            EXECUTE IMMEDIATE 'INSERT INTO install_table values ('''||err_msg||''')';
        GOTO bypass_install;
		
		END;
		
		--Inserts for PMM_RuleTypeParameter
		BEGIN
			EXECUTE IMMEDIATE ' INSERT INTO WFS.PMM_RuleTypeParameter (ID_, NAME ,RULETYPEID, Order_, DataTypeID, ISREQUIRED,CreateDate, UpdateDate)
				VALUES(1,''Number Of days'',1,1,3,1,TO_DATE(''30/04/2008 11:00:00 AM'',''DD/MM/YYYY HH12:MI:SS PM''), TO_DATE(''30/04/2008 11:00:00 AM'',''DD/MM/YYYY HH12:MI:SS PM''))';
			EXECUTE IMMEDIATE ' INSERT INTO WFS.PMM_RuleTypeParameter (ID_, NAME ,RULETYPEID, Order_, DataTypeID, ISREQUIRED,CreateDate, UpdateDate)
				VALUES(2,''TimeFrame'',1,2,4,1,TO_DATE(''30/04/2008 11:00:00 AM'',''DD/MM/YYYY HH12:MI:SS PM''), TO_DATE(''30/04/2008 11:00:00 AM'',''DD/MM/YYYY HH12:MI:SS PM''))';
			EXECUTE IMMEDIATE ' INSERT INTO WFS.PMM_RuleTypeParameter (ID_, NAME ,RULETYPEID, Order_, DataTypeID, ISREQUIRED,CreateDate, UpdateDate)
				VALUES(3,''Metadata reference'',1,3,5,1,TO_DATE(''30/04/2008 11:00:00 AM'',''DD/MM/YYYY HH12:MI:SS PM''), TO_DATE(''30/04/2008 11:00:00 AM'',''DD/MM/YYYY HH12:MI:SS PM''))';
			EXECUTE IMMEDIATE ' INSERT INTO WFS.PMM_RuleTypeParameter (ID_, NAME ,RULETYPEID, Order_, DataTypeID, ISREQUIRED,CreateDate, UpdateDate)
				VALUES(4,''Time'',1,4,2,0,TO_DATE(''30/04/2008 11:00:00 AM'',''DD/MM/YYYY HH12:MI:SS PM''), TO_DATE(''30/04/2008 11:00:00 AM'',''DD/MM/YYYY HH12:MI:SS PM''))';
		EXCEPTION 
			WHEN OTHERS THEN
				wk_message := 'ERROR';
				err_msg :=SUBSTR(SQLERRM, 1, 500);
				EXECUTE IMMEDIATE 'INSERT INTO install_table values (''error in installing of application database objects:'||
            	 					'Unable to insert into PMM_RuleTypeParameter.'')';
            EXECUTE IMMEDIATE 'INSERT INTO install_table values ('''||err_msg||''')';
        GOTO bypass_install;
		
		END;
		
		--Inserts for PMM_RULETYPEPARAMETERDATATYPE
		BEGIN
			EXECUTE IMMEDIATE 'INSERT INTO WFS.PMM_RULETYPEPARAMETERDATATYPE (ID_,Value,CreateDate, UpdateDate)
									 VALUES(1,''DATE'',TO_DATE(''30/04/2008 11:00:00 AM'',''DD/MM/YYYY HH12:MI:SS PM''), TO_DATE(''30/04/2008 11:00:00 AM'',''DD/MM/YYYY HH12:MI:SS PM''))';
			EXECUTE IMMEDIATE 'INSERT INTO WFS.PMM_RULETYPEPARAMETERDATATYPE (ID_,Value,CreateDate, UpdateDate)
									 VALUES(2,''TIME'',TO_DATE(''30/04/2008 11:00:00 AM'',''DD/MM/YYYY HH12:MI:SS PM''), TO_DATE(''30/04/2008 11:00:00 AM'',''DD/MM/YYYY HH12:MI:SS PM''))';
			EXECUTE IMMEDIATE 'INSERT INTO WFS.PMM_RULETYPEPARAMETERDATATYPE (ID_,Value,CreateDate, UpdateDate)
									 VALUES(3,''INTEGER'',TO_DATE(''30/04/2008 11:00:00 AM'',''DD/MM/YYYY HH12:MI:SS PM''), TO_DATE(''30/04/2008 11:00:00 AM'',''DD/MM/YYYY HH12:MI:SS PM''))';
			EXECUTE IMMEDIATE 'INSERT INTO WFS.PMM_RULETYPEPARAMETERDATATYPE (ID_,Value,CreateDate, UpdateDate)
									 VALUES(4,''OPTIONS'',TO_DATE(''30/04/2008 11:00:00 AM'',''DD/MM/YYYY HH12:MI:SS PM''), TO_DATE(''30/04/2008 11:00:00 AM'',''DD/MM/YYYY HH12:MI:SS PM''))';
			EXECUTE IMMEDIATE 'INSERT INTO WFS.PMM_RULETYPEPARAMETERDATATYPE (ID_,Value,CreateDate, UpdateDate)
									 VALUES(5,''PARAMETERREF'',TO_DATE(''30/04/2008 11:00:00 AM'',''DD/MM/YYYY HH12:MI:SS PM''), TO_DATE(''30/04/2008 11:00:00 AM'',''DD/MM/YYYY HH12:MI:SS PM''))';
			EXECUTE IMMEDIATE 'INSERT INTO WFS.PMM_RULETYPEPARAMETERDATATYPE (ID_,Value,CreateDate, UpdateDate)
									 VALUES(6,''DAY'',TO_DATE(''30/04/2008 11:00:00 AM'',''DD/MM/YYYY HH12:MI:SS PM''), TO_DATE(''30/04/2008 11:00:00 AM'',''DD/MM/YYYY HH12:MI:SS PM''))';
		EXCEPTION 
			WHEN OTHERS THEN
				wk_message := 'ERROR';
				err_msg :=SUBSTR(SQLERRM, 1, 500);
				EXECUTE IMMEDIATE 'INSERT INTO install_table values (''error in installing of application database objects:'||
            	 					'Unable to insert into PMM_RULETYPEPARAMETERDATATYPE.'')';
            EXECUTE IMMEDIATE 'INSERT INTO install_table values ('''||err_msg||''')';
        GOTO bypass_install;
		
		END;

		--PMM INSERTS FOR WFS.TTV_MODULE
		BEGIN
			EXECUTE IMMEDIATE 'INSERT INTO WFS.TTV_MODULE(ModuleID, NAME, CREATEDATE, UPDATEDATE)
				VALUES(10, ''Schedules'', TO_DATE(''13/05/2008 12:00:00 PM'',''DD/MM/YYYY HH12:MI:SS PM''), TO_DATE(''13/05/2008 12:00:00 PM'',''DD/MM/YYYY HH12:MI:SS PM''))';
			EXECUTE IMMEDIATE 'INSERT INTO WFS.TTV_MODULE(ModuleID, NAME, CREATEDATE, UPDATEDATE)
				VALUES(11, ''Partners'', TO_DATE(''13/05/2008 12:00:00 PM'',''DD/MM/YYYY HH12:MI:SS PM''), TO_DATE(''13/05/2008 12:00:00 PM'',''DD/MM/YYYY HH12:MI:SS PM''))';
			EXECUTE IMMEDIATE 'INSERT INTO WFS.TTV_MODULE(ModuleID, NAME, CREATEDATE, UPDATEDATE)
				VALUES(12, ''Titles'', TO_DATE(''13/05/2008 12:00:00 PM'',''DD/MM/YYYY HH12:MI:SS PM''), TO_DATE(''13/05/2008 12:00:00 PM'',''DD/MM/YYYY HH12:MI:SS PM''))';
		EXCEPTION 
			WHEN OTHERS THEN
				wk_message := 'ERROR';
				err_msg :=SUBSTR(SQLERRM, 1, 500);
				EXECUTE IMMEDIATE 'INSERT INTO install_table values (''error in installing of application database objects:'||
            	 					'Unable to insert PMM data into table TTV_MODULE.'')';
            EXECUTE IMMEDIATE 'INSERT INTO install_table values ('''||err_msg||''')';
        GOTO bypass_install;
				
		END;
		
		--PMM INSERTS FOR WFS.TTV_PERMISSION
		BEGIN
			EXECUTE IMMEDIATE 'INSERT INTO WFS.TTV_PERMISSION(PermissionID, NAME, SECTIONNAME, MODULEID, CREATEDATE, UPDATEDATE)
			   VALUES(26, ''View'', ''View Schedules'', 10, TO_DATE(''13/05/2008 12:00:00 PM'',''DD/MM/YYYY HH12:MI:SS PM''), TO_DATE(''13/05/2008 12:00:00 PM'',''DD/MM/YYYY HH12:MI:SS PM''))';
			EXECUTE IMMEDIATE 'INSERT INTO WFS.TTV_PERMISSION(PermissionID, NAME, SECTIONNAME, MODULEID, CREATEDATE, UPDATEDATE)
			   VALUES(27, ''Create'', ''Create Schedules'', 10, TO_DATE(''13/05/2008 12:00:00 PM'',''DD/MM/YYYY HH12:MI:SS PM''), TO_DATE(''13/05/2008 12:00:00 PM'',''DD/MM/YYYY HH12:MI:SS PM''))';
			EXECUTE IMMEDIATE 'INSERT INTO WFS.TTV_PERMISSION(PermissionID, NAME, SECTIONNAME, MODULEID, CREATEDATE, UPDATEDATE)
			   VALUES(28, ''Modify'', ''Modify Schedules'', 10, TO_DATE(''13/05/2008 12:00:00 PM'',''DD/MM/YYYY HH12:MI:SS PM''), TO_DATE(''13/05/2008 12:00:00 PM'',''DD/MM/YYYY HH12:MI:SS PM''))';
			EXECUTE IMMEDIATE 'INSERT INTO WFS.TTV_PERMISSION(PermissionID, NAME, SECTIONNAME, MODULEID, CREATEDATE, UPDATEDATE)
			   VALUES(29, ''Delete'', ''Delete Schedules'', 10, TO_DATE(''13/05/2008 12:00:00 PM'',''DD/MM/YYYY HH12:MI:SS PM''), TO_DATE(''13/05/2008 12:00:00 PM'',''DD/MM/YYYY HH12:MI:SS PM''))';
			EXECUTE IMMEDIATE 'INSERT INTO WFS.TTV_PERMISSION(PermissionID, NAME, SECTIONNAME, MODULEID, CREATEDATE, UPDATEDATE)
			   VALUES(30, ''Approve'', ''Approve Schedules'', 10, TO_DATE(''13/05/2008 12:00:00 PM'',''DD/MM/YYYY HH12:MI:SS PM''), TO_DATE(''13/05/2008 12:00:00 PM'',''DD/MM/YYYY HH12:MI:SS PM''))';
			EXECUTE IMMEDIATE 'INSERT INTO WFS.TTV_PERMISSION(PermissionID, NAME, SECTIONNAME, MODULEID, CREATEDATE, UPDATEDATE)
			   VALUES(31, ''View'', ''View Partners'', 11, TO_DATE(''13/05/2008 12:00:00 PM'',''DD/MM/YYYY HH12:MI:SS PM''), TO_DATE(''13/05/2008 12:00:00 PM'',''DD/MM/YYYY HH12:MI:SS PM''))';
			EXECUTE IMMEDIATE 'INSERT INTO WFS.TTV_PERMISSION(PermissionID, NAME, SECTIONNAME, MODULEID, CREATEDATE, UPDATEDATE)
			   VALUES(32, ''Create'', ''Create Partners'', 11, TO_DATE(''13/05/2008 12:00:00 PM'',''DD/MM/YYYY HH12:MI:SS PM''), TO_DATE(''13/05/2008 12:00:00 PM'',''DD/MM/YYYY HH12:MI:SS PM''))';
			EXECUTE IMMEDIATE 'INSERT INTO WFS.TTV_PERMISSION(PermissionID, NAME, SECTIONNAME, MODULEID, CREATEDATE, UPDATEDATE)
			   VALUES(33, ''Modify'', ''Modify Partners'', 11, TO_DATE(''13/05/2008 12:00:00 PM'',''DD/MM/YYYY HH12:MI:SS PM''), TO_DATE(''13/05/2008 12:00:00 PM'',''DD/MM/YYYY HH12:MI:SS PM''))';
			EXECUTE IMMEDIATE 'INSERT INTO WFS.TTV_PERMISSION(PermissionID, NAME, SECTIONNAME, MODULEID, CREATEDATE, UPDATEDATE)
			   VALUES(34, ''Delete'', ''Delete Partners'', 11, TO_DATE(''13/05/2008 12:00:00 PM'',''DD/MM/YYYY HH12:MI:SS PM''), TO_DATE(''13/05/2008 12:00:00 PM'',''DD/MM/YYYY HH12:MI:SS PM''))';
			EXECUTE IMMEDIATE 'INSERT INTO WFS.TTV_PERMISSION(PermissionID, NAME, SECTIONNAME, MODULEID, CREATEDATE, UPDATEDATE)
			   VALUES(35, ''View'', ''View Titles'', 12, TO_DATE(''13/05/2008 12:00:00 PM'',''DD/MM/YYYY HH12:MI:SS PM''), TO_DATE(''13/05/2008 12:00:00 PM'',''DD/MM/YYYY HH12:MI:SS PM''))';
			EXECUTE IMMEDIATE 'INSERT INTO WFS.TTV_PERMISSION(PermissionID, NAME, SECTIONNAME, MODULEID, CREATEDATE, UPDATEDATE)
			   VALUES(36, ''Create'', ''Create Titles'', 12, TO_DATE(''13/05/2008 12:00:00 PM'',''DD/MM/YYYY HH12:MI:SS PM''), TO_DATE(''13/05/2008 12:00:00 PM'',''DD/MM/YYYY HH12:MI:SS PM''))';
			EXECUTE IMMEDIATE 'INSERT INTO WFS.TTV_PERMISSION(PermissionID, NAME, SECTIONNAME, MODULEID, CREATEDATE, UPDATEDATE)
			   VALUES(37, ''Modify'', ''Modify Titles'', 12, TO_DATE(''13/05/2008 12:00:00 PM'',''DD/MM/YYYY HH12:MI:SS PM''), TO_DATE(''13/05/2008 12:00:00 PM'',''DD/MM/YYYY HH12:MI:SS PM''))';
			EXECUTE IMMEDIATE 'INSERT INTO WFS.TTV_PERMISSION(PermissionID, NAME, SECTIONNAME, MODULEID, CREATEDATE, UPDATEDATE)
			   VALUES(38, ''Delete'', ''Delete Titles'', 12, TO_DATE(''13/05/2008 12:00:00 PM'',''DD/MM/YYYY HH12:MI:SS PM''), TO_DATE(''13/05/2008 12:00:00 PM'',''DD/MM/YYYY HH12:MI:SS PM''))';
		EXCEPTION 
			WHEN OTHERS THEN
				wk_message := 'ERROR';
				err_msg :=SUBSTR(SQLERRM, 1, 500);
				EXECUTE IMMEDIATE 'INSERT INTO install_table values (''error in installing of application database objects:'||
            	 					'Unable to insert PMM data into table TTV_PERMISSION.'')';
            EXECUTE IMMEDIATE 'INSERT INTO install_table values ('''||err_msg||''')';
        GOTO bypass_install;
				
		END;
		
		--PMM INSERTS FOR WFS.TTV_BIGROLEPERMISSION
		BEGIN
			EXECUTE IMMEDIATE 'INSERT INTO WFS.TTV_BIGROLEPERMISSION(BIGROLEPERMISSIONID, PERMISSIONID, BIGROLE, CREATEDATE) 
			    VALUES(WFS.TTV_BigRolePermission_SEQ.NEXTVAL, 26, ''Admin'', TO_DATE(''13/05/2008 12:00:00 PM'',''DD/MM/YYYY HH12:MI:SS PM''))';
			EXECUTE IMMEDIATE 'INSERT INTO WFS.TTV_BIGROLEPERMISSION(BIGROLEPERMISSIONID, PERMISSIONID, BIGROLE, CREATEDATE) 
			    VALUES(WFS.TTV_BigRolePermission_SEQ.NEXTVAL, 27, ''Admin'', TO_DATE(''13/05/2008 12:00:00 PM'',''DD/MM/YYYY HH12:MI:SS PM''))';
			EXECUTE IMMEDIATE 'INSERT INTO WFS.TTV_BIGROLEPERMISSION(BIGROLEPERMISSIONID, PERMISSIONID, BIGROLE, CREATEDATE) 
			    VALUES(WFS.TTV_BigRolePermission_SEQ.NEXTVAL, 28, ''Admin'', TO_DATE(''13/05/2008 12:00:00 PM'',''DD/MM/YYYY HH12:MI:SS PM''))';
			EXECUTE IMMEDIATE 'INSERT INTO WFS.TTV_BIGROLEPERMISSION(BIGROLEPERMISSIONID, PERMISSIONID, BIGROLE, CREATEDATE) 
			    VALUES(WFS.TTV_BigRolePermission_SEQ.NEXTVAL, 29, ''Admin'', TO_DATE(''13/05/2008 12:00:00 PM'',''DD/MM/YYYY HH12:MI:SS PM''))';
			EXECUTE IMMEDIATE 'INSERT INTO WFS.TTV_BIGROLEPERMISSION(BIGROLEPERMISSIONID, PERMISSIONID, BIGROLE, CREATEDATE) 
			    VALUES(WFS.TTV_BigRolePermission_SEQ.NEXTVAL, 30, ''Admin'', TO_DATE(''13/05/2008 12:00:00 PM'',''DD/MM/YYYY HH12:MI:SS PM''))';
			EXECUTE IMMEDIATE 'INSERT INTO WFS.TTV_BIGROLEPERMISSION(BIGROLEPERMISSIONID, PERMISSIONID, BIGROLE, CREATEDATE) 
			    VALUES(WFS.TTV_BigRolePermission_SEQ.NEXTVAL, 31, ''Admin'', TO_DATE(''13/05/2008 12:00:00 PM'',''DD/MM/YYYY HH12:MI:SS PM''))';
			EXECUTE IMMEDIATE 'INSERT INTO WFS.TTV_BIGROLEPERMISSION(BIGROLEPERMISSIONID, PERMISSIONID, BIGROLE, CREATEDATE) 
			    VALUES(WFS.TTV_BigRolePermission_SEQ.NEXTVAL, 32, ''Admin'', TO_DATE(''13/05/2008 12:00:00 PM'',''DD/MM/YYYY HH12:MI:SS PM''))';
			EXECUTE IMMEDIATE 'INSERT INTO WFS.TTV_BIGROLEPERMISSION(BIGROLEPERMISSIONID, PERMISSIONID, BIGROLE, CREATEDATE) 
			    VALUES(WFS.TTV_BigRolePermission_SEQ.NEXTVAL, 33, ''Admin'', TO_DATE(''13/05/2008 12:00:00 PM'',''DD/MM/YYYY HH12:MI:SS PM''))';
			EXECUTE IMMEDIATE 'INSERT INTO WFS.TTV_BIGROLEPERMISSION(BIGROLEPERMISSIONID, PERMISSIONID, BIGROLE, CREATEDATE) 
			    VALUES(WFS.TTV_BigRolePermission_SEQ.NEXTVAL, 34, ''Admin'', TO_DATE(''13/05/2008 12:00:00 PM'',''DD/MM/YYYY HH12:MI:SS PM''))';
			EXECUTE IMMEDIATE 'INSERT INTO WFS.TTV_BIGROLEPERMISSION(BIGROLEPERMISSIONID, PERMISSIONID, BIGROLE, CREATEDATE) 
			    VALUES(WFS.TTV_BigRolePermission_SEQ.NEXTVAL, 35, ''Admin'', TO_DATE(''13/05/2008 12:00:00 PM'',''DD/MM/YYYY HH12:MI:SS PM''))';
			EXECUTE IMMEDIATE 'INSERT INTO WFS.TTV_BIGROLEPERMISSION(BIGROLEPERMISSIONID, PERMISSIONID, BIGROLE, CREATEDATE) 
			    VALUES(WFS.TTV_BigRolePermission_SEQ.NEXTVAL, 36, ''Admin'', TO_DATE(''13/05/2008 12:00:00 PM'',''DD/MM/YYYY HH12:MI:SS PM''))';
			EXECUTE IMMEDIATE 'INSERT INTO WFS.TTV_BIGROLEPERMISSION(BIGROLEPERMISSIONID, PERMISSIONID, BIGROLE, CREATEDATE) 
			    VALUES(WFS.TTV_BigRolePermission_SEQ.NEXTVAL, 37, ''Admin'', TO_DATE(''13/05/2008 12:00:00 PM'',''DD/MM/YYYY HH12:MI:SS PM''))';
			EXECUTE IMMEDIATE 'INSERT INTO WFS.TTV_BIGROLEPERMISSION(BIGROLEPERMISSIONID, PERMISSIONID, BIGROLE, CREATEDATE) 
			    VALUES(WFS.TTV_BigRolePermission_SEQ.NEXTVAL, 38, ''Admin'', TO_DATE(''13/05/2008 12:00:00 PM'',''DD/MM/YYYY HH12:MI:SS PM''))';
		EXCEPTION 
			WHEN OTHERS THEN
				wk_message := 'ERROR';
				err_msg :=SUBSTR(SQLERRM, 1, 500);
				EXECUTE IMMEDIATE 'INSERT INTO install_table values (''error in installing of application database objects:'||
            	 					'Unable to insert PMM data into table TTV_BIGROLEPERMISSION.'')';
            EXECUTE IMMEDIATE 'INSERT INTO install_table values ('''||err_msg||''')';
        GOTO bypass_install;
				
		END;
		
		--PMM INSERTS FOR WFS.TTV_MENUITEM
		BEGIN		
			EXECUTE IMMEDIATE 'INSERT INTO WFS.TTV_MENUITEM(MENUITEMID, NAME, PERMISSIONID, CREATEDATE, UPDATEDATE) 
			    VALUES(47, ''TabbedPMMSchedules'', 26, TO_DATE(''13/05/2008 12:00:00 PM'',''DD/MM/YYYY HH12:MI:SS PM''), TO_DATE(''13/05/2008 12:00:00 PM'',''DD/MM/YYYY HH12:MI:SS PM''))';
			EXECUTE IMMEDIATE 'INSERT INTO WFS.TTV_MENUITEM(MENUITEMID, NAME, PERMISSIONID, CREATEDATE, UPDATEDATE) 
			    VALUES(48, ''TabbedPMMSchedulesView'', 26, TO_DATE(''13/05/2008 12:00:00 PM'',''DD/MM/YYYY HH12:MI:SS PM''), TO_DATE(''13/05/2008 12:00:00 PM'',''DD/MM/YYYY HH12:MI:SS PM''))';
			EXECUTE IMMEDIATE 'INSERT INTO WFS.TTV_MENUITEM(MENUITEMID, NAME, PERMISSIONID, CREATEDATE, UPDATEDATE) 
			    VALUES(49, ''TabbedPMMSchedulesCreate'', 27, TO_DATE(''13/05/2008 12:00:00 PM'',''DD/MM/YYYY HH12:MI:SS PM''), TO_DATE(''13/05/2008 12:00:00 PM'',''DD/MM/YYYY HH12:MI:SS PM''))';
			EXECUTE IMMEDIATE 'INSERT INTO WFS.TTV_MENUITEM(MENUITEMID, NAME, PERMISSIONID, CREATEDATE, UPDATEDATE) 
			    VALUES(50, ''TabbedPMMSchedulesModify'', 28, TO_DATE(''13/05/2008 12:00:00 PM'',''DD/MM/YYYY HH12:MI:SS PM''), TO_DATE(''13/05/2008 12:00:00 PM'',''DD/MM/YYYY HH12:MI:SS PM''))';
			EXECUTE IMMEDIATE 'INSERT INTO WFS.TTV_MENUITEM(MENUITEMID, NAME, PERMISSIONID, CREATEDATE, UPDATEDATE) 
			    VALUES(51, ''TabbedPMMPartners'', 31, TO_DATE(''13/05/2008 12:00:00 PM'',''DD/MM/YYYY HH12:MI:SS PM''), TO_DATE(''13/05/2008 12:00:00 PM'',''DD/MM/YYYY HH12:MI:SS PM''))';
			EXECUTE IMMEDIATE 'INSERT INTO WFS.TTV_MENUITEM(MENUITEMID, NAME, PERMISSIONID, CREATEDATE, UPDATEDATE) 
			    VALUES(52, ''TabbedPMMPartnersView'', 31, TO_DATE(''13/05/2008 12:00:00 PM'',''DD/MM/YYYY HH12:MI:SS PM''), TO_DATE(''13/05/2008 12:00:00 PM'',''DD/MM/YYYY HH12:MI:SS PM''))';
			EXECUTE IMMEDIATE 'INSERT INTO WFS.TTV_MENUITEM(MENUITEMID, NAME, PERMISSIONID, CREATEDATE, UPDATEDATE) 
			    VALUES(53, ''TabbedPMMPartnersCreate'', 32, TO_DATE(''13/05/2008 12:00:00 PM'',''DD/MM/YYYY HH12:MI:SS PM''), TO_DATE(''13/05/2008 12:00:00 PM'',''DD/MM/YYYY HH12:MI:SS PM''))';
			EXECUTE IMMEDIATE 'INSERT INTO WFS.TTV_MENUITEM(MENUITEMID, NAME, PERMISSIONID, CREATEDATE, UPDATEDATE) 
			    VALUES(54, ''TabbedPMMPartnersModify'', 33, TO_DATE(''13/05/2008 12:00:00 PM'',''DD/MM/YYYY HH12:MI:SS PM''), TO_DATE(''13/05/2008 12:00:00 PM'',''DD/MM/YYYY HH12:MI:SS PM''))';
			EXECUTE IMMEDIATE 'INSERT INTO WFS.TTV_MENUITEM(MENUITEMID, NAME, PERMISSIONID, CREATEDATE, UPDATEDATE) 
			    VALUES(55, ''TabbedPMMTitles'', 35, TO_DATE(''13/05/2008 12:00:00 PM'',''DD/MM/YYYY HH12:MI:SS PM''), TO_DATE(''13/05/2008 12:00:00 PM'',''DD/MM/YYYY HH12:MI:SS PM''))';
			EXECUTE IMMEDIATE 'INSERT INTO WFS.TTV_MENUITEM(MENUITEMID, NAME, PERMISSIONID, CREATEDATE, UPDATEDATE) 
			    VALUES(56, ''TabbedPMMTitlesView_'', 35, TO_DATE(''13/05/2008 12:00:00 PM'',''DD/MM/YYYY HH12:MI:SS PM''), TO_DATE(''16/06/2008 12:00:00 PM'',''DD/MM/YYYY HH12:MI:SS PM''))';
			EXECUTE IMMEDIATE 'INSERT INTO WFS.TTV_MENUITEM(MENUITEMID, NAME, PERMISSIONID, CREATEDATE, UPDATEDATE) 
			    VALUES(57, ''TabbedPMMTitlesInternalSearch'', 35, TO_DATE(''13/05/2008 12:00:00 PM'',''DD/MM/YYYY HH12:MI:SS PM''), TO_DATE(''13/05/2008 12:00:00 PM'',''DD/MM/YYYY HH12:MI:SS PM''))';
			EXECUTE IMMEDIATE 'INSERT INTO WFS.TTV_MENUITEM(MENUITEMID, NAME, PERMISSIONID, CREATEDATE, UPDATEDATE) 
			    VALUES(58, ''TabbedPMMTitlesCreate'', 36, TO_DATE(''13/05/2008 12:00:00 PM'',''DD/MM/YYYY HH12:MI:SS PM''), TO_DATE(''13/05/2008 12:00:00 PM'',''DD/MM/YYYY HH12:MI:SS PM''))';
			EXECUTE IMMEDIATE 'INSERT INTO WFS.TTV_MENUITEM(MENUITEMID, NAME, PERMISSIONID, CREATEDATE, UPDATEDATE) 
			    VALUES(59, ''TabbedPMMTitlesModify_'', 37, TO_DATE(''13/05/2008 12:00:00 PM'',''DD/MM/YYYY HH12:MI:SS PM''), TO_DATE(''16/06/2008 12:00:00 PM'',''DD/MM/YYYY HH12:MI:SS PM''))';
			EXECUTE IMMEDIATE 'INSERT INTO WFS.TTV_MENUITEM(MENUITEMID, NAME, PERMISSIONID, CREATEDATE, UPDATEDATE) 
			    VALUES(60, ''TabbedPMMPartnersGeneral'', 33, TO_DATE(''16/06/2008 12:00:00 PM'',''DD/MM/YYYY HH12:MI:SS PM''), TO_DATE(''16/06/2008 12:00:00 PM'',''DD/MM/YYYY HH12:MI:SS PM''))';
			EXECUTE IMMEDIATE 'INSERT INTO WFS.TTV_MENUITEM(MENUITEMID, NAME, PERMISSIONID, CREATEDATE, UPDATEDATE) 
			    VALUES(61, ''TabbedPMMPartnersJobs'', 33, TO_DATE(''16/06/2008 12:00:00 PM'',''DD/MM/YYYY HH12:MI:SS PM''), TO_DATE(''16/06/2008 12:00:00 PM'',''DD/MM/YYYY HH12:MI:SS PM''))';
			EXECUTE IMMEDIATE 'INSERT INTO WFS.TTV_MENUITEM(MENUITEMID, NAME, PERMISSIONID, CREATEDATE, UPDATEDATE) 
			    VALUES(62, ''TabbedPMMPartnersSchedules'', 33, TO_DATE(''16/06/2008 12:00:00 PM'',''DD/MM/YYYY HH12:MI:SS PM''), TO_DATE(''16/06/2008 12:00:00 PM'',''DD/MM/YYYY HH12:MI:SS PM''))';
		EXCEPTION 
			WHEN OTHERS THEN
				wk_message := 'ERROR';
				err_msg :=SUBSTR(SQLERRM, 1, 500);
				EXECUTE IMMEDIATE 'INSERT INTO install_table values (''error in installing of application database objects:'||
            	 					'Unable to insert PMM data into table TTV_MENUITEM.'')';
            EXECUTE IMMEDIATE 'INSERT INTO install_table values ('''||err_msg||''')';
        GOTO bypass_install;
				
		END;
		
		--PMM INSERTS FOR WFS.TTV_ACTION
		BEGIN			
			EXECUTE IMMEDIATE 'INSERT INTO WFS.TTV_ACTION(ACTIONID, NAME, PERMISSIONID, PATH, CREATEDATE, UPDATEDATE) 
			    VALUES(101, ''View Schedule'', 26, ''schedules.do?method=getSchedulesDefaultView'', TO_DATE(''13/05/2008 12:00:00 PM'',''DD/MM/YYYY HH12:MI:SS PM''), TO_DATE(''13/05/2008 12:00:00 PM'',''DD/MM/YYYY HH12:MI:SS PM''))';
			EXECUTE IMMEDIATE 'INSERT INTO WFS.TTV_ACTION(ACTIONID, NAME, PERMISSIONID, PATH, CREATEDATE, UPDATEDATE) 
			    VALUES(102, ''Create Schedule'', 27, ''schedules.do?method=createSchedule'', TO_DATE(''13/05/2008 12:00:00 PM'',''DD/MM/YYYY HH12:MI:SS PM''), TO_DATE(''13/05/2008 12:00:00 PM'',''DD/MM/YYYY HH12:MI:SS PM''))';
			EXECUTE IMMEDIATE 'INSERT INTO WFS.TTV_ACTION(ACTIONID, NAME, PERMISSIONID, PATH, CREATEDATE, UPDATEDATE) 
			    VALUES(103, ''View Partner'', 31, ''partners.do?method=getPartnersView'', TO_DATE(''13/05/2008 12:00:00 PM'',''DD/MM/YYYY HH12:MI:SS PM''), TO_DATE(''13/05/2008 12:00:00 PM'',''DD/MM/YYYY HH12:MI:SS PM''))';
			EXECUTE IMMEDIATE 'INSERT INTO WFS.TTV_ACTION(ACTIONID, NAME, PERMISSIONID, PATH, CREATEDATE, UPDATEDATE) 
			    VALUES(104, ''Create Partner'', 32, ''partners.do?method=createPartner'', TO_DATE(''13/05/2008 12:00:00 PM'',''DD/MM/YYYY HH12:MI:SS PM''), TO_DATE(''13/05/2008 12:00:00 PM'',''DD/MM/YYYY HH12:MI:SS PM''))';
			EXECUTE IMMEDIATE 'INSERT INTO WFS.TTV_ACTION(ACTIONID, NAME, PERMISSIONID, PATH, CREATEDATE, UPDATEDATE) 
			    VALUES(105, ''View Title'', 35, ''viewTitle.do'', TO_DATE(''13/05/2008 12:00:00 PM'',''DD/MM/YYYY HH12:MI:SS PM''), TO_DATE(''16/06/2008 12:00:00 PM'',''DD/MM/YYYY HH12:MI:SS PM''))';
			EXECUTE IMMEDIATE 'INSERT INTO WFS.TTV_ACTION(ACTIONID, NAME, PERMISSIONID, PATH, CREATEDATE, UPDATEDATE) 
			    VALUES(106, ''Internal Search'', 35, ''titlesearch.do?method=showSearchPage'', TO_DATE(''13/05/2008 12:00:00 PM'',''DD/MM/YYYY HH12:MI:SS PM''), TO_DATE(''13/05/2008 12:00:00 PM'',''DD/MM/YYYY HH12:MI:SS PM''))';
			EXECUTE IMMEDIATE 'INSERT INTO WFS.TTV_ACTION(ACTIONID, NAME, PERMISSIONID, PATH, CREATEDATE, UPDATEDATE) 
			    VALUES(107, ''Create Title'', 36, ''createTitle.do'', TO_DATE(''13/05/2008 12:00:00 PM'',''DD/MM/YYYY HH12:MI:SS PM''), TO_DATE(''16/06/2008 12:00:00 PM'',''DD/MM/YYYY HH12:MI:SS PM''))';
			EXECUTE IMMEDIATE 'INSERT INTO WFS.TTV_ACTION(ACTIONID, NAME, PERMISSIONID, PATH, CREATEDATE, UPDATEDATE) 
			    VALUES(108, ''Get template parameters for job'', 31, ''jobManagement.do?method=getTemplateParameters'', TO_DATE(''03/06/2008 12:00:00 PM'',''DD/MM/YYYY HH12:MI:SS PM''), TO_DATE(''03/06/2008 12:00:00 PM'',''DD/MM/YYYY HH12:MI:SS PM''))';
			EXECUTE IMMEDIATE 'INSERT INTO WFS.TTV_ACTION(ACTIONID, NAME, PERMISSIONID, PATH, CREATEDATE, UPDATEDATE) 
			    VALUES(109, ''Show job page'', 31, ''jobManagement.do?method=showJobPage'', TO_DATE(''03/06/2008 12:00:00 PM'',''DD/MM/YYYY HH12:MI:SS PM''), TO_DATE(''03/06/2008 12:00:00 PM'',''DD/MM/YYYY HH12:MI:SS PM''))';
			EXECUTE IMMEDIATE 'INSERT INTO WFS.TTV_ACTION(ACTIONID, NAME, PERMISSIONID, PATH, CREATEDATE, UPDATEDATE) 
			    VALUES(110, ''Create/Modify job'', 32, ''jobManagement.do?method=saveJob'', TO_DATE(''03/06/2008 12:00:00 PM'',''DD/MM/YYYY HH12:MI:SS PM''), TO_DATE(''03/06/2008 12:00:00 PM'',''DD/MM/YYYY HH12:MI:SS PM''))';
			EXECUTE IMMEDIATE 'INSERT INTO WFS.TTV_ACTION(ACTIONID, NAME, PERMISSIONID, PATH, CREATEDATE, UPDATEDATE) 
			    VALUES(111, ''Delete jobs'', 34, ''jobListManagement.do?method=deleteJobs'', TO_DATE(''03/06/2008 12:00:00 PM'',''DD/MM/YYYY HH12:MI:SS PM''), TO_DATE(''03/06/2008 12:00:00 PM'',''DD/MM/YYYY HH12:MI:SS PM''))';
			EXECUTE IMMEDIATE 'INSERT INTO WFS.TTV_ACTION(ACTIONID, NAME, PERMISSIONID, PATH, CREATEDATE, UPDATEDATE) 
			    VALUES(112, ''View Titles'', 35, ''titlelist.do?method=search'', TO_DATE(''09/06/2008 12:00:00 PM'',''DD/MM/YYYY HH12:MI:SS PM''), TO_DATE(''09/06/2008 12:00:00 PM'',''DD/MM/YYYY HH12:MI:SS PM''))';
			EXECUTE IMMEDIATE 'INSERT INTO WFS.TTV_ACTION(ACTIONID, NAME, PERMISSIONID, PATH, CREATEDATE, UPDATEDATE) 
			    VALUES(113, ''Schedule View'', 26, ''getschedule.do'', TO_DATE(''09/06/2008 12:00:00 PM'',''DD/MM/YYYY HH12:MI:SS PM''), TO_DATE(''09/06/2008 12:00:00 PM'',''DD/MM/YYYY HH12:MI:SS PM''))';
			EXECUTE IMMEDIATE 'INSERT INTO WFS.TTV_ACTION(ACTIONID, NAME, PERMISSIONID, PATH, CREATEDATE, UPDATEDATE) 
			    VALUES(114, ''Schedule Activity View'', 26, ''scheduleactivity.do'', TO_DATE(''09/06/2008 12:00:00 PM'',''DD/MM/YYYY HH12:MI:SS PM''), TO_DATE(''09/06/2008 12:00:00 PM'',''DD/MM/YYYY HH12:MI:SS PM''))';
			EXECUTE IMMEDIATE 'INSERT INTO WFS.TTV_ACTION(ACTIONID, NAME, PERMISSIONID, PATH, CREATEDATE, UPDATEDATE) 
			    VALUES(115, ''Schedule Basic View'', 26, ''scheduletitles.do'', TO_DATE(''09/06/2008 12:00:00 PM'',''DD/MM/YYYY HH12:MI:SS PM''), TO_DATE(''09/06/2008 12:00:00 PM'',''DD/MM/YYYY HH12:MI:SS PM''))';
			EXECUTE IMMEDIATE 'INSERT INTO WFS.TTV_ACTION(ACTIONID, NAME, PERMISSIONID, PATH, CREATEDATE, UPDATEDATE) 
			    VALUES(116, ''Show Create Schedule Page'', 27, ''createschedule.do'', TO_DATE(''09/06/2008 12:00:00 PM'',''DD/MM/YYYY HH12:MI:SS PM''), TO_DATE(''09/06/2008 12:00:00 PM'',''DD/MM/YYYY HH12:MI:SS PM''))';
			EXECUTE IMMEDIATE 'INSERT INTO WFS.TTV_ACTION(ACTIONID, NAME, PERMISSIONID, PATH, CREATEDATE, UPDATEDATE) 
			    VALUES(117, ''Create Schedule'', 28, ''saveschedule.do'', TO_DATE(''09/06/2008 12:00:00 PM'',''DD/MM/YYYY HH12:MI:SS PM''), TO_DATE(''09/06/2008 12:00:00 PM'',''DD/MM/YYYY HH12:MI:SS PM''))';
			EXECUTE IMMEDIATE 'INSERT INTO WFS.TTV_ACTION(ACTIONID, NAME, PERMISSIONID, PATH, CREATEDATE, UPDATEDATE) 
			    VALUES(118, ''Schedule Add Titles - Search'', 28, ''addtitles.do'', TO_DATE(''09/06/2008 12:00:00 PM'',''DD/MM/YYYY HH12:MI:SS PM''), TO_DATE(''09/06/2008 12:00:00 PM'',''DD/MM/YYYY HH12:MI:SS PM''))';
			EXECUTE IMMEDIATE 'INSERT INTO WFS.TTV_ACTION(ACTIONID, NAME, PERMISSIONID, PATH, CREATEDATE, UPDATEDATE) 
			    VALUES(119, ''Delete Titles From Schedule'', 28, ''deletetitles.do'', TO_DATE(''09/06/2008 12:00:00 PM'',''DD/MM/YYYY HH12:MI:SS PM''), TO_DATE(''09/06/2008 12:00:00 PM'',''DD/MM/YYYY HH12:MI:SS PM''))';
			EXECUTE IMMEDIATE 'INSERT INTO WFS.TTV_ACTION(ACTIONID, NAME, PERMISSIONID, PATH, CREATEDATE, UPDATEDATE) 
			    VALUES(120, ''Add Titles To Schedule'', 28, ''addtitlestoschedule.do'', TO_DATE(''09/06/2008 12:00:00 PM'',''DD/MM/YYYY HH12:MI:SS PM''), TO_DATE(''09/06/2008 12:00:00 PM'',''DD/MM/YYYY HH12:MI:SS PM''))';
			EXECUTE IMMEDIATE 'INSERT INTO WFS.TTV_ACTION(ACTIONID, NAME, PERMISSIONID, PATH, CREATEDATE, UPDATEDATE) 
			    VALUES(121, ''Approve Schedule'', 30, ''approveschedule.do'', TO_DATE(''09/06/2008 12:00:00 PM'',''DD/MM/YYYY HH12:MI:SS PM''), TO_DATE(''09/06/2008 12:00:00 PM'',''DD/MM/YYYY HH12:MI:SS PM''))';
			EXECUTE IMMEDIATE 'INSERT INTO WFS.TTV_ACTION(ACTIONID, NAME, PERMISSIONID, PATH, CREATEDATE, UPDATEDATE) 
			    VALUES(122, ''Delete Schedule'', 29, ''deleteschedule.do'', TO_DATE(''09/06/2008 12:00:00 PM'',''DD/MM/YYYY HH12:MI:SS PM''), TO_DATE(''09/06/2008 12:00:00 PM'',''DD/MM/YYYY HH12:MI:SS PM''))';
			EXECUTE IMMEDIATE 'INSERT INTO WFS.TTV_ACTION(ACTIONID, NAME, PERMISSIONID, PATH, CREATEDATE, UPDATEDATE) 
			    VALUES(123, ''View rules and menu'', 31, ''jobManagement.do?method=getScheduleRulesAndMenu'', TO_DATE(''16/06/2008 12:00:00 PM'',''DD/MM/YYYY HH12:MI:SS PM''), TO_DATE(''16/06/2008 12:00:00 PM'',''DD/MM/YYYY HH12:MI:SS PM''))';
			EXECUTE IMMEDIATE 'INSERT INTO WFS.TTV_ACTION(ACTIONID, NAME, PERMISSIONID, PATH, CREATEDATE, UPDATEDATE) 
			    VALUES(124, ''View job'', 31, ''jobManagement.do?method=getJob'', TO_DATE(''16/06/2008 12:00:00 PM'',''DD/MM/YYYY HH12:MI:SS PM''), TO_DATE(''16/06/2008 12:00:00 PM'',''DD/MM/YYYY HH12:MI:SS PM''))';
			EXECUTE IMMEDIATE 'INSERT INTO WFS.TTV_ACTION(ACTIONID, NAME, PERMISSIONID, PATH, CREATEDATE, UPDATEDATE) 
			    VALUES(125, ''Modify Title'', 37, ''editTitle.do'', TO_DATE(''16/06/2008 12:00:00 PM'',''DD/MM/YYYY HH12:MI:SS PM''), TO_DATE(''16/06/2008 12:00:00 PM'',''DD/MM/YYYY HH12:MI:SS PM''))';
			EXECUTE IMMEDIATE 'INSERT INTO WFS.TTV_ACTION(ACTIONID, NAME, PERMISSIONID, PATH, CREATEDATE, UPDATEDATE) 
			    VALUES(126, ''Create Partner'', 32, ''partnerManagement.do?method=createPartnerSetup'', TO_DATE(''16/06/2008 12:00:00 PM'',''DD/MM/YYYY HH12:MI:SS PM''), TO_DATE(''16/06/2008 12:00:00 PM'',''DD/MM/YYYY HH12:MI:SS PM''))';
			EXECUTE IMMEDIATE 'INSERT INTO WFS.TTV_ACTION(ACTIONID, NAME, PERMISSIONID, PATH, CREATEDATE, UPDATEDATE) 
			    VALUES(127, ''Delete Partners'', 34, ''partnerManagement.do?method=deletePartners'', TO_DATE(''16/06/2008 12:00:00 PM'',''DD/MM/YYYY HH12:MI:SS PM''), TO_DATE(''16/06/2008 12:00:00 PM'',''DD/MM/YYYY HH12:MI:SS PM''))';
			EXECUTE IMMEDIATE 'INSERT INTO WFS.TTV_ACTION(ACTIONID, NAME, PERMISSIONID, PATH, CREATEDATE, UPDATEDATE) 
			    VALUES(128, ''Save Partner'', 32, ''partnerManagement.do?method=createPartner'', TO_DATE(''16/06/2008 12:00:00 PM'',''DD/MM/YYYY HH12:MI:SS PM''), TO_DATE(''16/06/2008 12:00:00 PM'',''DD/MM/YYYY HH12:MI:SS PM''))';
			EXECUTE IMMEDIATE 'INSERT INTO WFS.TTV_ACTION(ACTIONID, NAME, PERMISSIONID, PATH, CREATEDATE, UPDATEDATE) 
			    VALUES(129, ''Get Partner'', 33, ''partnerManagement.do?method=getPartnerDetails'', TO_DATE(''16/06/2008 12:00:00 PM'',''DD/MM/YYYY HH12:MI:SS PM''), TO_DATE(''16/06/2008 12:00:00 PM'',''DD/MM/YYYY HH12:MI:SS PM''))';
			EXECUTE IMMEDIATE 'INSERT INTO WFS.TTV_ACTION(ACTIONID, NAME, PERMISSIONID, PATH, CREATEDATE, UPDATEDATE) 
			    VALUES(130, ''Update Partner'', 33, ''partnerManagement.do?method=updatePartner'', TO_DATE(''16/06/2008 12:00:00 PM'',''DD/MM/YYYY HH12:MI:SS PM''), TO_DATE(''16/06/2008 12:00:00 PM'',''DD/MM/YYYY HH12:MI:SS PM''))';
			EXECUTE IMMEDIATE 'INSERT INTO WFS.TTV_ACTION(ACTIONID, NAME, PERMISSIONID, PATH, CREATEDATE, UPDATEDATE) 
			    VALUES(131, ''Jobs For Partner'', 33, ''partnerJobsManagement.do?method=getJobsForPartner'', TO_DATE(''16/06/2008 12:00:00 PM'',''DD/MM/YYYY HH12:MI:SS PM''), TO_DATE(''16/06/2008 12:00:00 PM'',''DD/MM/YYYY HH12:MI:SS PM''))';
			EXECUTE IMMEDIATE 'INSERT INTO WFS.TTV_ACTION(ACTIONID, NAME, PERMISSIONID, PATH, CREATEDATE, UPDATEDATE) 
			    VALUES(132, ''Schedules For Partner'', 33, ''partnerSchedulesManagement.do?method=getCurrentSchedulesForPartner'', TO_DATE(''16/06/2008 12:00:00 PM'',''DD/MM/YYYY HH12:MI:SS PM''), TO_DATE(''16/06/2008 12:00:00 PM'',''DD/MM/YYYY HH12:MI:SS PM''))';
			EXECUTE IMMEDIATE 'INSERT INTO WFS.TTV_ACTION(ACTIONID, NAME, PERMISSIONID, PATH, CREATEDATE, UPDATEDATE) 
			    VALUES(133, ''Schedule Timetable'', 26, ''schedules.do'', TO_DATE(''17/06/2008 12:00:00 PM'',''DD/MM/YYYY HH12:MI:SS PM''), TO_DATE(''17/06/2008 12:00:00 PM'',''DD/MM/YYYY HH12:MI:SS PM''))';
		EXCEPTION 
			WHEN OTHERS THEN
				wk_message := 'ERROR';
				err_msg :=SUBSTR(SQLERRM, 1, 500);
				EXECUTE IMMEDIATE 'INSERT INTO install_table values (''error in installing of application database objects:'||
            	 					'Unable to insert PMM data into table TTV_ACTION.'')';
            EXECUTE IMMEDIATE 'INSERT INTO install_table values ('''||err_msg||''')';
        GOTO bypass_install;
				
		END;
		
		/*------------------------------------------------------------------
								Create PMM Sequences
		------------------------------------------------------------------*/
		
		--Create Sequence for PMM_TitleMetaData
		BEGIN
			EXECUTE IMMEDIATE 'CREATE SEQUENCE WFS.PMM_TitleMetaData_SEQ
                              INCREMENT BY 1
                              START WITH 1
                              NOMAXVALUE
                              NOMINVALUE
                              NOCYCLE
                              CACHE 20
                              NOORDER';
		EXCEPTION 
			WHEN OTHERS THEN
				wk_message := 'ERROR';
				err_msg :=SUBSTR(SQLERRM, 1, 500);
				EXECUTE IMMEDIATE 'INSERT INTO install_table values (''error in installing of application database objects:'||
            	 					'Unable to create sequence PMM_TitleStatus_SEQ.'')';
            EXECUTE IMMEDIATE 'INSERT INTO install_table values ('''||err_msg||''')';
        GOTO bypass_install;
				
		END;
		
		--Create Sequence for PMM_Title
		BEGIN
			EXECUTE IMMEDIATE 'CREATE SEQUENCE WFS.PMM_Title_SEQ
                              INCREMENT BY 1
                              START WITH 1
                              NOMAXVALUE
                              NOMINVALUE
                              NOCYCLE
                              CACHE 20
                              NOORDER';
		EXCEPTION 
			WHEN OTHERS THEN
				wk_message := 'ERROR';
				err_msg :=SUBSTR(SQLERRM, 1, 500);
				EXECUTE IMMEDIATE 'INSERT INTO install_table values (''error in installing of application database objects:'||
            	 					'Unable to create sequence PMM_TitleStatus_SEQ.'')';
            EXECUTE IMMEDIATE 'INSERT INTO install_table values ('''||err_msg||''')';
        GOTO bypass_install;
				
		END;
		
		--Create Sequence for PMM_TitleList
		BEGIN
			EXECUTE IMMEDIATE 'CREATE SEQUENCE WFS.PMM_TitleList_SEQ
                              INCREMENT BY 1
                              START WITH 1
                              NOMAXVALUE
                              NOMINVALUE
                              NOCYCLE
                              CACHE 10
                              NOORDER';
		EXCEPTION 
			WHEN OTHERS THEN
				wk_message := 'ERROR';
				err_msg :=SUBSTR(SQLERRM, 1, 500);
				EXECUTE IMMEDIATE 'INSERT INTO install_table values (''error in installing of application database objects:'||
            	 					'Unable to create sequence PMM_TitleList_SEQ.'')';
            EXECUTE IMMEDIATE 'INSERT INTO install_table values ('''||err_msg||''')';
        GOTO bypass_install;
				
		END;
		
		--Create Sequence for PMM_ProgressItem
		BEGIN
			EXECUTE IMMEDIATE 'CREATE SEQUENCE WFS.PMM_ProgressItem_SEQ
                              INCREMENT BY 1
                              START WITH 1
                              NOMAXVALUE
                              NOMINVALUE
                              NOCYCLE
                              CACHE 20
                              NOORDER';
		EXCEPTION 
			WHEN OTHERS THEN
				wk_message := 'ERROR';
				err_msg :=SUBSTR(SQLERRM, 1, 500);
				EXECUTE IMMEDIATE 'INSERT INTO install_table values (''error in installing of application database objects:'||
            	 					'Unable to create sequence PMM_ProgressItem_SEQ.'')';
            EXECUTE IMMEDIATE 'INSERT INTO install_table values ('''||err_msg||''')';
        GOTO bypass_install;
				
		END;
		
		--Create Sequence for PMM_Partner
		BEGIN
			EXECUTE IMMEDIATE 'CREATE SEQUENCE WFS.PMM_Partner_SEQ
                              INCREMENT BY 1
                              START WITH 1
                              NOMAXVALUE
                              NOMINVALUE
                              NOCYCLE
                              NOCACHE
                              NOORDER';
		EXCEPTION 
			WHEN OTHERS THEN
				wk_message := 'ERROR';
				err_msg :=SUBSTR(SQLERRM, 1, 500);
				EXECUTE IMMEDIATE 'INSERT INTO install_table values (''error in installing of application database objects:'||
            	 					'Unable to create sequence PMM_Partner_SEQ.'')';
            EXECUTE IMMEDIATE 'INSERT INTO install_table values ('''||err_msg||''')';
        GOTO bypass_install;
				
		END;
		
		--Create Sequence for PMM_Context
		BEGIN
			EXECUTE IMMEDIATE 'CREATE SEQUENCE WFS.PMM_Context_SEQ
                              INCREMENT BY 1
                              START WITH 1
                              NOMAXVALUE
                              NOMINVALUE
                              NOCYCLE
                              CACHE 10
                              NOORDER';
		EXCEPTION 
			WHEN OTHERS THEN
				wk_message := 'ERROR';
				err_msg :=SUBSTR(SQLERRM, 1, 500);
				EXECUTE IMMEDIATE 'INSERT INTO install_table values (''error in installing of application database objects:'||
            	 					'Unable to create sequence PMM_Context_SEQ.'')';
            EXECUTE IMMEDIATE 'INSERT INTO install_table values ('''||err_msg||''')';
        GOTO bypass_install;
				
		END;
		
		--Create Sequence for PMM_Contact
		BEGIN
			EXECUTE IMMEDIATE 'CREATE SEQUENCE WFS.PMM_Contact_SEQ
                              INCREMENT BY 1
                              START WITH 1
                              NOMAXVALUE
                              NOMINVALUE
                              NOCYCLE
                              NOCACHE
                              NOORDER';
		EXCEPTION 
			WHEN OTHERS THEN
				wk_message := 'ERROR';
				err_msg :=SUBSTR(SQLERRM, 1, 500);
				EXECUTE IMMEDIATE 'INSERT INTO install_table values (''error in installing of application database objects:'||
            	 					'Unable to create sequence PMM_Contact_SEQ.'')';
            EXECUTE IMMEDIATE 'INSERT INTO install_table values ('''||err_msg||''')';
        GOTO bypass_install;
				
		END;
		
		--Create Sequence for PMM_Rule
		BEGIN
			EXECUTE IMMEDIATE 'CREATE SEQUENCE WFS.PMM_Rule_SEQ
                              INCREMENT BY 1
                              START WITH 1
                              NOMAXVALUE
                              NOMINVALUE
                              NOCYCLE
                              NOCACHE
                              NOORDER';
		EXCEPTION 
			WHEN OTHERS THEN
				wk_message := 'ERROR';
				err_msg :=SUBSTR(SQLERRM, 1, 500);
				EXECUTE IMMEDIATE 'INSERT INTO install_table values (''error in installing of application database objects:'||
            	 					'Unable to create sequence PMM_Rule_SEQ.'')';
            EXECUTE IMMEDIATE 'INSERT INTO install_table values ('''||err_msg||''')';
        GOTO bypass_install;
				
		END;
		
		--Create Sequence for PMM_RuleParameter
		BEGIN
			EXECUTE IMMEDIATE 'CREATE SEQUENCE WFS.PMM_RuleParameter_SEQ
                              INCREMENT BY 1
                              START WITH 1
                              NOMAXVALUE
                              NOMINVALUE
                              NOCYCLE
                              NOCACHE
                              NOORDER';
		EXCEPTION 
			WHEN OTHERS THEN
				wk_message := 'ERROR';
				err_msg :=SUBSTR(SQLERRM, 1, 500);
				EXECUTE IMMEDIATE 'INSERT INTO install_table values (''error in installing of application database objects:'||
            	 					'Unable to create sequence PMM_RuleParameter_SEQ.'')';
            EXECUTE IMMEDIATE 'INSERT INTO install_table values ('''||err_msg||''')';
        GOTO bypass_install;
				
		END;
		
		--Create Sequence for PMM_Service
		BEGIN
			EXECUTE IMMEDIATE 'CREATE SEQUENCE WFS.PMM_Service_SEQ
                              INCREMENT BY 1
                              START WITH 1
                              NOMAXVALUE
                              NOMINVALUE
                              NOCYCLE
                              NOCACHE
                              NOORDER';
		EXCEPTION 
			WHEN OTHERS THEN
				wk_message := 'ERROR';
				err_msg :=SUBSTR(SQLERRM, 1, 500);
				EXECUTE IMMEDIATE 'INSERT INTO install_table values (''error in installing of application database objects:'||
            	 					'Unable to create sequence PMM_Service_SEQ.'')';
            EXECUTE IMMEDIATE 'INSERT INTO install_table values ('''||err_msg||''')';
        GOTO bypass_install;
				
		END;
		
		--Create Sequence for PMM_PitchFrequency
		BEGIN
			EXECUTE IMMEDIATE 'CREATE SEQUENCE WFS.PMM_PitchFrequency_SEQ
                              INCREMENT BY 1
                              START WITH 1
                              NOMAXVALUE
                              NOMINVALUE
                              NOCYCLE
                              NOCACHE
                              NOORDER';
		EXCEPTION 
			WHEN OTHERS THEN
				wk_message := 'ERROR';
				err_msg :=SUBSTR(SQLERRM, 1, 500);
				EXECUTE IMMEDIATE 'INSERT INTO install_table values (''error in installing of application database objects:'||
            	 					'Unable to create sequence PMM_PitchFrequency_SEQ.'')';
            EXECUTE IMMEDIATE 'INSERT INTO install_table values ('''||err_msg||''')';
        GOTO bypass_install;
				
		END;
		
		--Create Sequence for PMM_Job
		BEGIN
			EXECUTE IMMEDIATE 'CREATE SEQUENCE WFS.PMM_Job_SEQ
                              INCREMENT BY 1
                              START WITH 1
                              NOMAXVALUE
                              NOMINVALUE
                              NOCYCLE
                              NOCACHE
                              NOORDER';
		EXCEPTION 
			WHEN OTHERS THEN
				wk_message := 'ERROR';
				err_msg :=SUBSTR(SQLERRM, 1, 500);
				EXECUTE IMMEDIATE 'INSERT INTO install_table values (''error in installing of application database objects:'||
            	 					'Unable to create sequence PMM_Job_SEQ.'')';
            EXECUTE IMMEDIATE 'INSERT INTO install_table values ('''||err_msg||''')';
        GOTO bypass_install;
				
		END;
		
		--Create Sequence for PMM_WatchFolderConfiguration
		BEGIN
			EXECUTE IMMEDIATE 'CREATE SEQUENCE WFS.PMM_WatchFlderConfig_SEQ
                              INCREMENT BY 1
                              START WITH 1
                              NOMAXVALUE
                              NOMINVALUE
                              NOCYCLE
                              NOCACHE
                              NOORDER';
		EXCEPTION 
			WHEN OTHERS THEN
				wk_message := 'ERROR';
				err_msg :=SUBSTR(SQLERRM, 1, 500);
				EXECUTE IMMEDIATE 'INSERT INTO install_table values (''error in installing of application database objects:'||
            	 					'Unable to create sequence PMM_WatchFolderConfiguration_SEQ.'')';
            EXECUTE IMMEDIATE 'INSERT INTO install_table values ('''||err_msg||''')';
        GOTO bypass_install;
				
		END;
		
		--Create Sequence for PMM_JobParameter
		BEGIN
			EXECUTE IMMEDIATE 'CREATE SEQUENCE WFS.PMM_JobParameter_SEQ
                              INCREMENT BY 1
                              START WITH 1
                              NOMAXVALUE
                              NOMINVALUE
                              NOCYCLE
                              NOCACHE
                              NOORDER';
		EXCEPTION 
			WHEN OTHERS THEN
				wk_message := 'ERROR';
				err_msg :=SUBSTR(SQLERRM, 1, 500);
				EXECUTE IMMEDIATE 'INSERT INTO install_table values (''error in installing of application database objects:'||
            	 					'Unable to create sequence PMM_JobParameter_SEQ.'')';
            EXECUTE IMMEDIATE 'INSERT INTO install_table values ('''||err_msg||''')';
        GOTO bypass_install;
				
		END;
		
		--Create Sequence for PMM_PROPERTIES
		BEGIN
			EXECUTE IMMEDIATE 'CREATE SEQUENCE WFS.PMM_PROPERTIES_SEQ
                              INCREMENT BY 1
                              START WITH 1
                              NOMAXVALUE
                              NOMINVALUE
                              NOCYCLE
                              NOCACHE
                              NOORDER';
		EXCEPTION 
			WHEN OTHERS THEN
				wk_message := 'ERROR';
				err_msg :=SUBSTR(SQLERRM, 1, 500);
				EXECUTE IMMEDIATE 'INSERT INTO install_table values (''error in installing of application database objects:'||
            	 					'Unable to create sequence PMM_PROPERTIES_SEQ.'')';
            EXECUTE IMMEDIATE 'INSERT INTO install_table values ('||err_msg||')';
        GOTO bypass_install;
				
		END;
		
		
		/*------------------------------------------------------------------
								Create PMM Triggers
		------------------------------------------------------------------*/
		
		-- Update the UpdateDate for PMM_TitleStatus
		BEGIN
			EXECUTE IMMEDIATE 'CREATE TRIGGER WFS.TRG_PMM_TitleStatus_UPD
                              BEFORE UPDATE
                              ON WFS.PMM_TitleStatus
                              FOR EACH ROW
                              DECLARE updatedate      date;
                              BEGIN
                              	SELECT  SYSTIMESTAMP
                              	INTO    updatedate
                              	FROM    DUAL;
                              	:NEW.UpdateDate := updatedate;
                              END;';
		EXCEPTION 
			WHEN OTHERS THEN
				wk_message := 'ERROR';
				err_msg :=SUBSTR(SQLERRM, 1, 500);
				EXECUTE IMMEDIATE 'INSERT INTO install_table values (''error in installing of application database objects:'||
            	 					'Unable to create trigger TRG_PMM_TitleStatus_UPD.'')';
            EXECUTE IMMEDIATE 'INSERT INTO install_table values ('''||err_msg||''')';
        GOTO bypass_install;
				
		END;
		
		-- Update the UpdateDate for PMM_TitleMetaData
		BEGIN
			EXECUTE IMMEDIATE 'CREATE TRIGGER WFS.TRG_PMM_TitleMetaData_UPD
                              BEFORE UPDATE
                              ON WFS.PMM_TitleMetaData
                              FOR EACH ROW
                              DECLARE updatedate      date;
                              BEGIN
                              	SELECT  SYSTIMESTAMP
                              	INTO    updatedate
                              	FROM    DUAL;
                              	:NEW.UpdateDate := updatedate;
                              END;';
		EXCEPTION 
			WHEN OTHERS THEN
				wk_message := 'ERROR';
				err_msg :=SUBSTR(SQLERRM, 1, 500);
				EXECUTE IMMEDIATE 'INSERT INTO install_table values (''error in installing of application database objects:'||
            	 					'Unable to create trigger TRG_PMM_TitleMetaData_UPD.'')';
            EXECUTE IMMEDIATE 'INSERT INTO install_table values ('''||err_msg||''')';
        GOTO bypass_install;
				
		END;
		
		-- Set ID_ for PMM_TitleMetaData
		BEGIN
			EXECUTE IMMEDIATE 'CREATE TRIGGER WFS.TRG_PMM_TitleMetaData_SEQ
                           	BEFORE INSERT ON WFS.PMM_TitleMetaData
                           	FOR EACH ROW
                           	BEGIN
                           	    IF :NEW.ID_ IS NULL THEN
                           	        SELECT WFS.PMM_TitleMetaData_SEQ.NEXTVAL INTO :NEW.ID_ FROM DUAL;
                           	    END IF;
                           	END;';
		EXCEPTION 
			WHEN OTHERS THEN
				wk_message := 'ERROR';
				err_msg :=SUBSTR(SQLERRM, 1, 500);
				EXECUTE IMMEDIATE 'INSERT INTO install_table values (''error in installing of application database objects:'||
            	 					'Unable to create trigger TRG_PMM_TitleMetaData_SEQ.'')';
            EXECUTE IMMEDIATE 'INSERT INTO install_table values ('''||err_msg||''')';
        GOTO bypass_install;
				
		END;
		
		-- Update the UpdateDate for PMM_Title
		BEGIN
			EXECUTE IMMEDIATE 'CREATE TRIGGER WFS.TRG_PMM_Title_UPD
                              BEFORE UPDATE
                              ON WFS.PMM_Title
                              FOR EACH ROW
                              DECLARE updatedate      date;
                              BEGIN
                              	SELECT  SYSTIMESTAMP
                              	INTO    updatedate
                              	FROM    DUAL;
                              	:NEW.UpdateDate := updatedate;
                              END;';
		EXCEPTION 
			WHEN OTHERS THEN
				wk_message := 'ERROR';
				err_msg :=SUBSTR(SQLERRM, 1, 500);
				EXECUTE IMMEDIATE 'INSERT INTO install_table values (''error in installing of application database objects:'||
            	 					'Unable to create trigger TRG_PMM_Title_UPD.'')';
            EXECUTE IMMEDIATE 'INSERT INTO install_table values ('''||err_msg||''')';
        GOTO bypass_install;
				
		END;
		
		-- Set ID_ for PMM_Title
		BEGIN
			EXECUTE IMMEDIATE 'CREATE TRIGGER WFS.TRG_PMM_Title_SEQ
                           	BEFORE INSERT ON WFS.PMM_Title
                           	FOR EACH ROW
                           	BEGIN
                           	    IF :NEW.ID_ IS NULL THEN
                           	        SELECT WFS.PMM_Title_SEQ.NEXTVAL INTO :NEW.ID_ FROM DUAL;
                           	    END IF;
                           	END;';
		EXCEPTION 
			WHEN OTHERS THEN
				wk_message := 'ERROR';
				err_msg :=SUBSTR(SQLERRM, 1, 500);
				EXECUTE IMMEDIATE 'INSERT INTO install_table values (''error in installing of application database objects:'||
            	 					'Unable to create trigger TRG_PMM_Title_SEQ.'')';
            EXECUTE IMMEDIATE 'INSERT INTO install_table values ('''||err_msg||''')';
        GOTO bypass_install;
				
		END;
		
		-- Update the UpdateDate for PMM_TitleListStatus
		BEGIN
			EXECUTE IMMEDIATE 'CREATE TRIGGER WFS.TRG_PMM_TitleListStatus_UPD
                              BEFORE UPDATE
                              ON WFS.PMM_TitleListStatus
                              FOR EACH ROW
                              DECLARE updatedate      date;
                              BEGIN
                              	SELECT  SYSTIMESTAMP
                              	INTO    updatedate
                              	FROM    DUAL;
                              	:NEW.UpdateDate := updatedate;
                              END;';
		EXCEPTION 
			WHEN OTHERS THEN
				wk_message := 'ERROR';
				err_msg :=SUBSTR(SQLERRM, 1, 500);
				EXECUTE IMMEDIATE 'INSERT INTO install_table values (''error in installing of application database objects:'||
            	 					'Unable to create trigger TRG_PMM_TitleListStatus_UPD.'')';
            EXECUTE IMMEDIATE 'INSERT INTO install_table values ('''||err_msg||''')';
        GOTO bypass_install;
				
		END;
		
		-- Update the UpdateDate for PMM_TitleList
		BEGIN
			EXECUTE IMMEDIATE 'CREATE TRIGGER WFS.TRG_PMM_TitleList_UPD
                              BEFORE UPDATE
                              ON WFS.PMM_TitleList
                              FOR EACH ROW
                              DECLARE updatedate      date;
                              BEGIN
                              	SELECT  SYSTIMESTAMP
                              	INTO    updatedate
                              	FROM    DUAL;
                              	:NEW.UpdateDate := updatedate;
                              END;';
		EXCEPTION 
			WHEN OTHERS THEN
				wk_message := 'ERROR';
				err_msg :=SUBSTR(SQLERRM, 1, 500);
				EXECUTE IMMEDIATE 'INSERT INTO install_table values (''error in installing of application database objects:'||
            	 					'Unable to create trigger TRG_PMM_TitleList_UPD.'')';
            EXECUTE IMMEDIATE 'INSERT INTO install_table values ('''||err_msg||''')';
        GOTO bypass_install;
				
		END;
		
		-- Update the UpdateDate for PMM_ProgressItem
		BEGIN
			EXECUTE IMMEDIATE 'CREATE TRIGGER WFS.TRG_PMM_ProgressItem_UPD
                              BEFORE UPDATE
                              ON WFS.PMM_ProgressItem
                              FOR EACH ROW
                              DECLARE updatedate      date;
                              BEGIN
                              	SELECT  SYSTIMESTAMP
                              	INTO    updatedate
                              	FROM    DUAL;
                              	:NEW.UpdateDate := updatedate;
                              END;';
		EXCEPTION 
			WHEN OTHERS THEN
				wk_message := 'ERROR';
				err_msg :=SUBSTR(SQLERRM, 1, 500);
				EXECUTE IMMEDIATE 'INSERT INTO install_table values (''error in installing of application database objects:'||
            	 					'Unable to create trigger TRG_PMM_ProgressItem_UPD.'')';
            EXECUTE IMMEDIATE 'INSERT INTO install_table values ('''||err_msg||''')';
        GOTO bypass_install;
				
		END;
		
		-- Set ID_ for PMM_ProgressItem
		BEGIN
			EXECUTE IMMEDIATE 'CREATE TRIGGER WFS.TRG_PMM_ProgressItem_SEQ
                           	BEFORE INSERT ON WFS.PMM_ProgressItem
                           	FOR EACH ROW
                           	BEGIN
                           	    IF :NEW.ID_ IS NULL THEN
                           	        SELECT WFS.PMM_ProgressItem_SEQ.NEXTVAL INTO :NEW.ID_ FROM DUAL;
                           	    END IF;
                           	END;';
		EXCEPTION 
			WHEN OTHERS THEN
				wk_message := 'ERROR';
				err_msg :=SUBSTR(SQLERRM, 1, 500);
				EXECUTE IMMEDIATE 'INSERT INTO install_table values (''error in installing of application database objects:'||
            	 					'Unable to create trigger TRG_PMM_ProgressItem_SEQ.'')';
            EXECUTE IMMEDIATE 'INSERT INTO install_table values ('''||err_msg||''')';
        GOTO bypass_install;
				
		END;
		
		-- Update the UpdateDate for PMM_TitleListDetails
		BEGIN
			EXECUTE IMMEDIATE 'CREATE TRIGGER WFS.TRG_PMM_TitleListDetails_UPD
                              BEFORE UPDATE
                              ON WFS.PMM_TitleListDetails
                              FOR EACH ROW
                              DECLARE updatedate      date;
                              BEGIN
                              	SELECT  SYSTIMESTAMP
                              	INTO    updatedate
                              	FROM    DUAL;
                              	:NEW.UpdateDate := updatedate;
                              END;';
		EXCEPTION 
			WHEN OTHERS THEN
				wk_message := 'ERROR';
				err_msg :=SUBSTR(SQLERRM, 1, 500);
				EXECUTE IMMEDIATE 'INSERT INTO install_table values (''error in installing of application database objects:'||
            	 					'Unable to create trigger TRG_PMM_TitleListDetails_UPD.'')';
            EXECUTE IMMEDIATE 'INSERT INTO install_table values ('''||err_msg||''')';
        GOTO bypass_install;
				
		END;
		
		-- Update the UpdateDate for PMM_TitleListDetailsType
		BEGIN
			EXECUTE IMMEDIATE 'CREATE TRIGGER WFS.TRG_PMM_TitleLstDetType_UPD
                              BEFORE UPDATE
                              ON WFS.PMM_TitleListDetailsType
                              FOR EACH ROW
                              DECLARE updatedate      date;
                              BEGIN
                              	SELECT  SYSTIMESTAMP
                              	INTO    updatedate
                              	FROM    DUAL;
                              	:NEW.UpdateDate := updatedate;
                              END;';
		EXCEPTION 
			WHEN OTHERS THEN
				wk_message := 'ERROR';
				err_msg :=SUBSTR(SQLERRM, 1, 500);
				EXECUTE IMMEDIATE 'INSERT INTO install_table values (''error in installing of application database objects:'||
            	 					'Unable to create trigger TRG_PMM_TitleListDetailsType_UPD.'')';
            EXECUTE IMMEDIATE 'INSERT INTO install_table values ('''||err_msg||''')';
        GOTO bypass_install;
				
		END;
		
		-- Update the UpdateDate for PMM_Partner
		BEGIN
			EXECUTE IMMEDIATE 'CREATE TRIGGER WFS.TRG_PMM_Partner_UPD
                              BEFORE UPDATE
                              ON WFS.PMM_Partner
                              FOR EACH ROW
                              DECLARE updatedate      date;
                              BEGIN
                              	SELECT  SYSTIMESTAMP
                              	INTO    updatedate
                              	FROM    DUAL;
                              	:NEW.UpdateDate := updatedate;
                              END;';
		EXCEPTION 
			WHEN OTHERS THEN
				wk_message := 'ERROR';
				err_msg :=SUBSTR(SQLERRM, 1, 500);
				EXECUTE IMMEDIATE 'INSERT INTO install_table values (''error in installing of application database objects:'||
            	 					'Unable to create trigger TRG_PMM_Partner_UPD.'')';
            EXECUTE IMMEDIATE 'INSERT INTO install_table values ('''||err_msg||''')';
        GOTO bypass_install;
				
		END;
		
		-- Set ID_ for PMM_Partner
		BEGIN
			EXECUTE IMMEDIATE 'CREATE TRIGGER WFS.TRG_PMM_Partner_SEQ
                           	BEFORE INSERT ON WFS.PMM_Partner
                           	FOR EACH ROW
                           	BEGIN
                           	    IF :NEW.ID_ IS NULL THEN
                           	        SELECT WFS.PMM_Partner_SEQ.NEXTVAL INTO :NEW.ID_ FROM DUAL;
                           	    END IF;
                           	END;';
		EXCEPTION 
			WHEN OTHERS THEN
				wk_message := 'ERROR';
				err_msg :=SUBSTR(SQLERRM, 1, 500);
				EXECUTE IMMEDIATE 'INSERT INTO install_table values (''error in installing of application database objects:'||
            	 					'Unable to create trigger TRG_PMM_Partner_SEQ.'')';
            EXECUTE IMMEDIATE 'INSERT INTO install_table values ('''||err_msg||''')';
        GOTO bypass_install;
				
		END;
		
		-- Update the UpdateDate for PMM_PartnerType
		BEGIN
			EXECUTE IMMEDIATE 'CREATE TRIGGER WFS.TRG_PMM_PartnerType_UPD
                              BEFORE UPDATE
                              ON WFS.PMM_PartnerType
                              FOR EACH ROW
                              DECLARE updatedate      date;
                              BEGIN
                              	SELECT  SYSTIMESTAMP
                              	INTO    updatedate
                              	FROM    DUAL;
                              	:NEW.UpdateDate := updatedate;
                              END;';
		EXCEPTION 
			WHEN OTHERS THEN
				wk_message := 'ERROR';
				err_msg :=SUBSTR(SQLERRM, 1, 500);
				EXECUTE IMMEDIATE 'INSERT INTO install_table values (''error in installing of application database objects:'||
            	 					'Unable to create trigger TRG_PMM_PartnerType_UPD.'')';
            EXECUTE IMMEDIATE 'INSERT INTO install_table values ('''||err_msg||''')';
        GOTO bypass_install;
				
		END;
		
		-- Update the UpdateDate for PMM_Context
		BEGIN
			EXECUTE IMMEDIATE 'CREATE TRIGGER WFS.TRG_PMM_Context_UPD
                              BEFORE UPDATE
                              ON WFS.PMM_Context
                              FOR EACH ROW
                              DECLARE updatedate      date;
                              BEGIN
                              	SELECT  SYSTIMESTAMP
                              	INTO    updatedate
                              	FROM    DUAL;
                              	:NEW.UpdateDate := updatedate;
                              END;';
		EXCEPTION 
			WHEN OTHERS THEN
				wk_message := 'ERROR';
				err_msg :=SUBSTR(SQLERRM, 1, 500);
				EXECUTE IMMEDIATE 'INSERT INTO install_table values (''error in installing of application database objects:'||
            	 					'Unable to create trigger TRG_PMM_Context_UPD.'')';
            EXECUTE IMMEDIATE 'INSERT INTO install_table values ('''||err_msg||''')';
        GOTO bypass_install;
				
		END;
		
		-- Set ID_ for PMM_Context
		BEGIN
			EXECUTE IMMEDIATE 'CREATE TRIGGER WFS.TRG_PMM_Context_SEQ
                           	BEFORE INSERT ON WFS.PMM_Context
                           	FOR EACH ROW
                           	BEGIN
                           	    IF :NEW.ID_ IS NULL THEN
                           	        SELECT WFS.PMM_Context_SEQ.NEXTVAL INTO :NEW.ID_ FROM DUAL;
                           	    END IF;
                           	END;';
		EXCEPTION 
			WHEN OTHERS THEN
				wk_message := 'ERROR';
				err_msg :=SUBSTR(SQLERRM, 1, 500);
				EXECUTE IMMEDIATE 'INSERT INTO install_table values (''error in installing of application database objects:'||
            	 					'Unable to create trigger TRG_PMM_Context_SEQ.'')';
            EXECUTE IMMEDIATE 'INSERT INTO install_table values ('''||err_msg||''')';
        GOTO bypass_install;
				
		END;
		
		-- Update the UpdateDate for PMM_ContainerType
		BEGIN
			EXECUTE IMMEDIATE 'CREATE TRIGGER WFS.TRG_PMM_ContainerType_UPD
                              BEFORE UPDATE
                              ON WFS.PMM_ContainerType
                              FOR EACH ROW
                              DECLARE updatedate      date;
                              BEGIN
                              	SELECT  SYSTIMESTAMP
                              	INTO    updatedate
                              	FROM    DUAL;
                              	:NEW.UpdateDate := updatedate;
                              END;';
		EXCEPTION 
			WHEN OTHERS THEN
				wk_message := 'ERROR';
				err_msg :=SUBSTR(SQLERRM, 1, 500);
				EXECUTE IMMEDIATE 'INSERT INTO install_table values (''error in installing of application database objects:'||
            	 					'Unable to create trigger TRG_PMM_ContainerType_UPD.'')';
            EXECUTE IMMEDIATE 'INSERT INTO install_table values ('''||err_msg||''')';
        GOTO bypass_install;
				
		END;

		-- Update the UpdateDate for PMM_Contact
		BEGIN
			EXECUTE IMMEDIATE 'CREATE TRIGGER WFS.TRG_PMM_Contact_UPD
                              BEFORE UPDATE
                              ON WFS.PMM_Contact
                              FOR EACH ROW
                              DECLARE updatedate      date;
                              BEGIN
                              	SELECT  SYSTIMESTAMP
                              	INTO    updatedate
                              	FROM    DUAL;
                              	:NEW.UpdateDate := updatedate;
                              END;';
		EXCEPTION 
			WHEN OTHERS THEN
				wk_message := 'ERROR';
				err_msg :=SUBSTR(SQLERRM, 1, 500);
				EXECUTE IMMEDIATE 'INSERT INTO install_table values (''error in installing of application database objects:'||
            	 					'Unable to create trigger TRG_PMM_Contact_UPD.'')';
            EXECUTE IMMEDIATE 'INSERT INTO install_table values ('''||err_msg||''')';
        GOTO bypass_install;
				
		END;
		
		-- Set ID_ for PMM_Contact
		BEGIN
			EXECUTE IMMEDIATE 'CREATE TRIGGER WFS.TRG_PMM_Contact_SEQ
                           	BEFORE INSERT ON WFS.PMM_Contact
                           	FOR EACH ROW
                           	BEGIN
                           	    IF :NEW.ID_ IS NULL THEN
                           	        SELECT WFS.PMM_Contact_SEQ.NEXTVAL INTO :NEW.ID_ FROM DUAL;
                           	    END IF;
                           	END;';
		EXCEPTION 
			WHEN OTHERS THEN
				wk_message := 'ERROR';
				err_msg :=SUBSTR(SQLERRM, 1, 500);
				EXECUTE IMMEDIATE 'INSERT INTO install_table values (''error in installing of application database objects:'||
            	 					'Unable to create trigger TRG_PMM_Contact_SEQ.'')';
            EXECUTE IMMEDIATE 'INSERT INTO install_table values ('''||err_msg||''')';
        GOTO bypass_install;
				
		END;
		
		-- Update the UpdateDate for PMM_RuleType
		BEGIN
			EXECUTE IMMEDIATE 'CREATE TRIGGER WFS.TRG_PMM_RuleType_UPD
                              BEFORE UPDATE
                              ON WFS.PMM_RuleType
                              FOR EACH ROW
                              DECLARE updatedate      date;
                              BEGIN
                              	SELECT  SYSTIMESTAMP
                              	INTO    updatedate
                              	FROM    DUAL;
                              	:NEW.UpdateDate := updatedate;
                              END;';
		EXCEPTION 
			WHEN OTHERS THEN
				wk_message := 'ERROR';
				err_msg :=SUBSTR(SQLERRM, 1, 500);
				EXECUTE IMMEDIATE 'INSERT INTO install_table values (''error in installing of application database objects:'||
            	 					'Unable to create trigger TRG_PMM_RuleType_UPD.'')';
            EXECUTE IMMEDIATE 'INSERT INTO install_table values ('''||err_msg||''')';
        GOTO bypass_install;
				
		END;
		
		-- Update the UpdateDate for PMM_Rule
		BEGIN
			EXECUTE IMMEDIATE 'CREATE TRIGGER WFS.TRG_PMM_Rule_UPD
                              BEFORE UPDATE
                              ON WFS.PMM_Rule
                              FOR EACH ROW
                              DECLARE updatedate      date;
                              BEGIN
                              	SELECT  SYSTIMESTAMP
                              	INTO    updatedate
                              	FROM    DUAL;
                              	:NEW.UpdateDate := updatedate;
                              END;';
		EXCEPTION 
			WHEN OTHERS THEN
				wk_message := 'ERROR';
				err_msg :=SUBSTR(SQLERRM, 1, 500);
				EXECUTE IMMEDIATE 'INSERT INTO install_table values (''error in installing of application database objects:'||
            	 					'Unable to create trigger TRG_PMM_Rule_UPD.'')';
            EXECUTE IMMEDIATE 'INSERT INTO install_table values ('''||err_msg||''')';
        GOTO bypass_install;
				
		END;
		
		-- Set ID_ for PMM_Rule
		BEGIN
			EXECUTE IMMEDIATE 'CREATE TRIGGER WFS.TRG_PMM_Rule_SEQ
                           	BEFORE INSERT ON WFS.PMM_Rule
                           	FOR EACH ROW
                           	BEGIN
                           	    IF :NEW.ID_ IS NULL THEN
                           	        SELECT WFS.PMM_Rule_SEQ.NEXTVAL INTO :NEW.ID_ FROM DUAL;
                           	    END IF;
                           	END;';
		EXCEPTION 
			WHEN OTHERS THEN
				wk_message := 'ERROR';
				err_msg :=SUBSTR(SQLERRM, 1, 500);
				EXECUTE IMMEDIATE 'INSERT INTO install_table values (''error in installing of application database objects:'||
            	 					'Unable to create trigger TRG_PMM_Rule_SEQ.'')';
            EXECUTE IMMEDIATE 'INSERT INTO install_table values ('''||err_msg||''')';
        GOTO bypass_install;
				
		END;
		
		-- Update the UpdateDate for PMM_RuleParameter
		BEGIN
			EXECUTE IMMEDIATE 'CREATE TRIGGER WFS.TRG_PMM_RuleParameter_UPD
                              BEFORE UPDATE
                              ON WFS.PMM_RuleParameter
                              FOR EACH ROW
                              DECLARE updatedate      date;
                              BEGIN
                              	SELECT  SYSTIMESTAMP
                              	INTO    updatedate
                              	FROM    DUAL;
                              	:NEW.UpdateDate := updatedate;
                              END;';
		EXCEPTION 
			WHEN OTHERS THEN
				wk_message := 'ERROR';
				err_msg :=SUBSTR(SQLERRM, 1, 500);
				EXECUTE IMMEDIATE 'INSERT INTO install_table values (''error in installing of application database objects:'||
            	 					'Unable to create trigger TRG_PMM_RuleParameter_UPD.'')';
            EXECUTE IMMEDIATE 'INSERT INTO install_table values ('''||err_msg||''')';
        GOTO bypass_install;
				
		END;
		
		-- Set ID_ for PMM_RuleParameter
		BEGIN
			EXECUTE IMMEDIATE 'CREATE TRIGGER WFS.TRG_PMM_RuleParameter_SEQ
                           	BEFORE INSERT ON WFS.PMM_RuleParameter
                           	FOR EACH ROW
                           	BEGIN
                           	    IF :NEW.ID_ IS NULL THEN
                           	        SELECT WFS.PMM_RuleParameter_SEQ.NEXTVAL INTO :NEW.ID_ FROM DUAL;
                           	    END IF;
                           	END;';
		EXCEPTION 
			WHEN OTHERS THEN
				wk_message := 'ERROR';
				err_msg :=SUBSTR(SQLERRM, 1, 500);
				EXECUTE IMMEDIATE 'INSERT INTO install_table values (''error in installing of application database objects:'||
            	 					'Unable to create trigger TRG_PMM_RuleParameter_SEQ.'')';
            EXECUTE IMMEDIATE 'INSERT INTO install_table values ('''||err_msg||''')';
        GOTO bypass_install;
				
		END;
		
		-- Update the UpdateDate for PMM_Service
		BEGIN
			EXECUTE IMMEDIATE 'CREATE TRIGGER WFS.TRG_PMM_Service_UPD
                              BEFORE UPDATE
                              ON WFS.PMM_Service
                              FOR EACH ROW
                              DECLARE updatedate      date;
                              BEGIN
                              	SELECT  SYSTIMESTAMP
                              	INTO    updatedate
                              	FROM    DUAL;
                              	:NEW.UpdateDate := updatedate;
                              END;';
		EXCEPTION 
			WHEN OTHERS THEN
				wk_message := 'ERROR';
				err_msg :=SUBSTR(SQLERRM, 1, 500);
				EXECUTE IMMEDIATE 'INSERT INTO install_table values (''error in installing of application database objects:'||
            	 					'Unable to create trigger TRG_PMM_Service_UPD.'')';
            EXECUTE IMMEDIATE 'INSERT INTO install_table values ('''||err_msg||''')';
        GOTO bypass_install;
				
		END;
		
		-- Set ID_ for PMM_Service
		BEGIN
			EXECUTE IMMEDIATE 'CREATE TRIGGER WFS.TRG_PMM_Service_SEQ
                           	BEFORE INSERT ON WFS.PMM_Service
                           	FOR EACH ROW
                           	BEGIN
                           	    IF :NEW.ID_ IS NULL THEN
                           	        SELECT WFS.PMM_Service_SEQ.NEXTVAL INTO :NEW.ID_ FROM DUAL;
                           	    END IF;
                           	END;';
		EXCEPTION 
			WHEN OTHERS THEN
				wk_message := 'ERROR';
				err_msg :=SUBSTR(SQLERRM, 1, 500);
				EXECUTE IMMEDIATE 'INSERT INTO install_table values (''error in installing of application database objects:'||
            	 					'Unable to create trigger TRG_PMM_Service_SEQ.'')';
            EXECUTE IMMEDIATE 'INSERT INTO install_table values ('''||err_msg||''')';
        GOTO bypass_install;
				
		END;
		
		-- Update the UpdateDate for PMM_PitchFrequency
		BEGIN
			EXECUTE IMMEDIATE 'CREATE TRIGGER WFS.TRG_PMM_PitchFrequency_UPD
                              BEFORE UPDATE
                              ON WFS.PMM_PitchFrequency
                              FOR EACH ROW
                              DECLARE updatedate      date;
                              BEGIN
                              	SELECT  SYSTIMESTAMP
                              	INTO    updatedate
                              	FROM    DUAL;
                              	:NEW.UpdateDate := updatedate;
                              END;';
		EXCEPTION 
			WHEN OTHERS THEN
				wk_message := 'ERROR';
				err_msg :=SUBSTR(SQLERRM, 1, 500);
				EXECUTE IMMEDIATE 'INSERT INTO install_table values (''error in installing of application database objects:'||
            	 					'Unable to create trigger TRG_PMM_PitchFrequency_UPD.'')';
            EXECUTE IMMEDIATE 'INSERT INTO install_table values ('''||err_msg||''')';
        GOTO bypass_install;
				
		END;
		
		-- Set ID_ for PMM_PitchFrequency
		BEGIN
			EXECUTE IMMEDIATE 'CREATE TRIGGER WFS.TRG_PMM_PitchFrequency_SEQ
                           	BEFORE INSERT ON WFS.PMM_PitchFrequency
                           	FOR EACH ROW
                           	BEGIN
                           	    IF :NEW.ID_ IS NULL THEN
                           	        SELECT WFS.PMM_PitchFrequency_SEQ.NEXTVAL INTO :NEW.ID_ FROM DUAL;
                           	    END IF;
                           	END;';
		EXCEPTION 
			WHEN OTHERS THEN
				wk_message := 'ERROR';
				err_msg :=SUBSTR(SQLERRM, 1, 500);
				EXECUTE IMMEDIATE 'INSERT INTO install_table values (''error in installing of application database objects:'||
            	 					'Unable to create trigger TRG_PMM_PitchFrequency_SEQ.'')';
            EXECUTE IMMEDIATE 'INSERT INTO install_table values ('''||err_msg||''')';
        GOTO bypass_install;
				
		END;
		
		-- Update the UpdateDate for PMM_Job
		BEGIN
			EXECUTE IMMEDIATE 'CREATE TRIGGER WFS.TRG_PMM_Job_UPD
                              BEFORE UPDATE
                              ON WFS.PMM_Job
                              FOR EACH ROW
                              DECLARE updatedate      date;
                              BEGIN
                              	SELECT  SYSTIMESTAMP
                              	INTO    updatedate
                              	FROM    DUAL;
                              	:NEW.UpdateDate := updatedate;
                              END;';
		EXCEPTION 
			WHEN OTHERS THEN
				wk_message := 'ERROR';
				err_msg :=SUBSTR(SQLERRM, 1, 500);
				EXECUTE IMMEDIATE 'INSERT INTO install_table values (''error in installing of application database objects:'||
            	 					'Unable to create trigger TRG_PMM_Job_UPD.'')';
            EXECUTE IMMEDIATE 'INSERT INTO install_table values ('''||err_msg||''')';
        GOTO bypass_install;
				
		END;
		
		-- Set ID_ for PMM_Job
		BEGIN
			EXECUTE IMMEDIATE 'CREATE TRIGGER WFS.TRG_PMM_Job_SEQ
                           	BEFORE INSERT ON WFS.PMM_Job
                           	FOR EACH ROW
                           	BEGIN
                           	    IF :NEW.ID_ IS NULL THEN
                           	        SELECT WFS.PMM_Job_SEQ.NEXTVAL INTO :NEW.ID_ FROM DUAL;
                           	    END IF;
                           	END;';
		EXCEPTION 
			WHEN OTHERS THEN
				wk_message := 'ERROR';
				err_msg :=SUBSTR(SQLERRM, 1, 500);
				EXECUTE IMMEDIATE 'INSERT INTO install_table values (''error in installing of application database objects:'||
            	 					'Unable to create trigger TRG_PMM_Job_SEQ.'')';
            EXECUTE IMMEDIATE 'INSERT INTO install_table values ('''||err_msg||''')';
        GOTO bypass_install;
				
		END;
		
		-- Update the UpdateDate for PMM_WatchFolderConfiguration
		BEGIN
			EXECUTE IMMEDIATE 'CREATE TRIGGER WFS.TRG_PMM_WatchFolderConfig_UPD
                              BEFORE UPDATE
                              ON WFS.PMM_WatchFolderConfiguration
                              FOR EACH ROW
                              DECLARE updatedate      date;
                              BEGIN
                              	SELECT  SYSTIMESTAMP
                              	INTO    updatedate
                              	FROM    DUAL;
                              	:NEW.UpdateDate := updatedate;
                              END;';
		EXCEPTION 
			WHEN OTHERS THEN
				wk_message := 'ERROR';
				err_msg :=SUBSTR(SQLERRM, 1, 500);
				EXECUTE IMMEDIATE 'INSERT INTO install_table values (''error in installing of application database objects:'||
            	 					'Unable to create trigger TRG_PMM_WatchFolderConfiguration_UPD.'')';
            EXECUTE IMMEDIATE 'INSERT INTO install_table values ('''||err_msg||''')';
        GOTO bypass_install;
				
		END;
		
		-- Set ID_ for PMM_WatchFolderConfiguration
		BEGIN
			EXECUTE IMMEDIATE 'CREATE TRIGGER WFS.TRG_PMM_WatchFolderConfig_SEQ
                           	BEFORE INSERT ON WFS.PMM_WatchFolderConfiguration
                           	FOR EACH ROW
                           	BEGIN
                           	    IF :NEW.ID_ IS NULL THEN
                           	        SELECT WFS.PMM_WatchFlderConfig_SEQ.NEXTVAL INTO :NEW.ID_ FROM DUAL;
                           	    END IF;
                           	END;';
		EXCEPTION 
			WHEN OTHERS THEN
				wk_message := 'ERROR';
				err_msg :=SUBSTR(SQLERRM, 1, 500);
				EXECUTE IMMEDIATE 'INSERT INTO install_table values (''error in installing of application database objects:'||
            	 					'Unable to create trigger TRG_PMM_WatchFolderConfiguration_SEQ.'')';
            EXECUTE IMMEDIATE 'INSERT INTO install_table values ('''||err_msg||''')';
        GOTO bypass_install;
				
		END;
		
		-- Update the UpdateDate for PMM_JobParameter
		BEGIN
			EXECUTE IMMEDIATE 'CREATE TRIGGER WFS.TRG_PMM_JobParameter_UPD
                              BEFORE UPDATE
                              ON WFS.PMM_JobParameter
                              FOR EACH ROW
                              DECLARE updatedate      date;
                              BEGIN
                              	SELECT  SYSTIMESTAMP
                              	INTO    updatedate
                              	FROM    DUAL;
                              	:NEW.UpdateDate := updatedate;
                              END;';
		EXCEPTION 
			WHEN OTHERS THEN
				wk_message := 'ERROR';
				err_msg :=SUBSTR(SQLERRM, 1, 500);
				EXECUTE IMMEDIATE 'INSERT INTO install_table values (''error in installing of application database objects:'||
            	 					'Unable to create trigger TRG_PMM_JobParameter_UPD.'')';
            EXECUTE IMMEDIATE 'INSERT INTO install_table values ('''||err_msg||''')';
        GOTO bypass_install;
				
		END;
		
		-- Set ID_ for PMM_JobParameter
		BEGIN
			EXECUTE IMMEDIATE 'CREATE TRIGGER WFS.TRG_PMM_JobParameter_SEQ
                           	BEFORE INSERT ON WFS.PMM_JobParameter
                           	FOR EACH ROW
                           	BEGIN
                           	    IF :NEW.ID_ IS NULL THEN
                           	        SELECT WFS.PMM_JobParameter_SEQ.NEXTVAL INTO :NEW.ID_ FROM DUAL;
                           	    END IF;
                           	END;';
		EXCEPTION 
			WHEN OTHERS THEN
				wk_message := 'ERROR';
				err_msg :=SUBSTR(SQLERRM, 1, 500);
				EXECUTE IMMEDIATE 'INSERT INTO install_table values (''error in installing of application database objects:'||
            	 					'Unable to create trigger TRG_PMM_JobParameter_SEQ.'')';
            EXECUTE IMMEDIATE 'INSERT INTO install_table values ('''||err_msg||''')';
        GOTO bypass_install;
				
		END;
		
		-- Update the UpdateDate for PMM_RULETYPEPARAMETERDATATYPE
		BEGIN
			EXECUTE IMMEDIATE 'CREATE TRIGGER WFS.TRG_RleTypeParmDtaType_UPD
                              BEFORE UPDATE
                              ON WFS.PMM_RULETYPEPARAMETERDATATYPE
                              FOR EACH ROW
                              DECLARE updatedate      date;
                              BEGIN
                              	SELECT  SYSTIMESTAMP
                              	INTO    updatedate
                              	FROM    DUAL;
                              	:NEW.UpdateDate := updatedate;
                              END;';
		EXCEPTION 
			WHEN OTHERS THEN
				wk_message := 'ERROR';
				err_msg :=SUBSTR(SQLERRM, 1, 500);
				EXECUTE IMMEDIATE 'INSERT INTO install_table values (''error in installing of application database objects:'||
            	 					'Unable to create trigger TRG_PMM_RULETYPEPARAMETERDATATYPE_UPD.'')';
            EXECUTE IMMEDIATE 'INSERT INTO install_table values ('''||err_msg||''')';
        GOTO bypass_install;
				
		END;
		
		-- Update the UpdateDate for PMM_RuleTypeParameter
		BEGIN
			EXECUTE IMMEDIATE 'CREATE TRIGGER WFS.TRG_PMM_PMM_RuleTypeParam_UPD
                              BEFORE UPDATE
                              ON WFS.PMM_RuleTypeParameter
                              FOR EACH ROW
                              DECLARE updatedate      date;
                              BEGIN
                              	SELECT  SYSTIMESTAMP
                              	INTO    updatedate
                              	FROM    DUAL;
                              	:NEW.UpdateDate := updatedate;
                              END;';
		EXCEPTION 
			WHEN OTHERS THEN
				wk_message := 'ERROR';
				err_msg :=SUBSTR(SQLERRM, 1, 500);
				EXECUTE IMMEDIATE 'INSERT INTO install_table values (''error in installing of application database objects:'||
            	 					'Unable to create trigger TRG_PMM_PMM_RuleTypeParam_UPD.'')';
            EXECUTE IMMEDIATE 'INSERT INTO install_table values ('''||err_msg||''')';
        GOTO bypass_install;
				
		END;
		
		-- Update the UpdateDate for PMM_PROPERTIES
		BEGIN
			EXECUTE IMMEDIATE 'CREATE TRIGGER WFS.TRG_PMM_PROPERTIES_UPD
                              BEFORE UPDATE
                              ON WFS.PMM_PROPERTIES
                              FOR EACH ROW
                              DECLARE updatedate      date;
                              BEGIN
                              	SELECT  SYSTIMESTAMP
                              	INTO    updatedate
                              	FROM    DUAL;
                              	:NEW.UpdateDate := updatedate;
                              END;';
		EXCEPTION 
			WHEN OTHERS THEN
				wk_message := 'ERROR';
				err_msg :=SUBSTR(SQLERRM, 1, 500);
				EXECUTE IMMEDIATE 'INSERT INTO install_table values (''error in installing of application database objects:'||
            	 					'Unable to create trigger TRG_PMM_PROPERTIES_UPD.'')';
            EXECUTE IMMEDIATE 'INSERT INTO install_table values ('||err_msg||')';
        GOTO bypass_install;
				
		END;
		
		-- Set ID_ for PMM_PROPERTIES
		BEGIN
			EXECUTE IMMEDIATE 'CREATE TRIGGER WFS.TRG_PMM_PROPERTIES_SEQ
                           	BEFORE INSERT ON WFS.PMM_PROPERTIES
                           	FOR EACH ROW
                           	BEGIN
                           	    IF :NEW.ID_ IS NULL THEN
                           	        SELECT WFS.PMM_PROPERTIES_SEQ.NEXTVAL INTO :NEW.ID_ FROM DUAL;
                           	    END IF;
                           	END;';
		EXCEPTION 
			WHEN OTHERS THEN
				wk_message := 'ERROR';
				err_msg :=SUBSTR(SQLERRM, 1, 500);
				EXECUTE IMMEDIATE 'INSERT INTO install_table values (''error in installing of application database objects:'||
            	 					'Unable to create trigger TRG_PMM_PROPERTIES_SEQ.'')';
            EXECUTE IMMEDIATE 'INSERT INTO install_table values ('||err_msg||')';
        GOTO bypass_install;
				
		END;
		
		/*------------------------------------------------------------------
								Create Foreign Keys
		------------------------------------------------------------------*/
		
		-- CREATE FOREIGN KEYS FOR PMM_TITLEMETADATA
		BEGIN
			EXECUTE IMMEDIATE 'ALTER TABLE WFS.PMM_TITLEMETADATA ADD (
                                  CONSTRAINT PMM_TITLEMETADATA#PMM_TITLE
                                          FOREIGN KEY (TitleID) 
                                          REFERENCES WFS.PMM_TITLE (ID_),
                                  CONSTRAINT PMM_TITLEMETADTA#TTV_DtaType
                                          FOREIGN KEY (DataTypeID)
                                          REFERENCES WFS.TTV_DataType (DataTypeID),
                                  CONSTRAINT PMM_TITLEMETADATA#PMM_TITLE2
														FOREIGN KEY (RootTitleID) 
														REFERENCES WFS.PMM_TITLE (ID_))';
		EXCEPTION 
			WHEN OTHERS THEN
				wk_message := 'ERROR';
				err_msg :=SUBSTR(SQLERRM, 1, 500);
				EXECUTE IMMEDIATE 'INSERT INTO install_table values(''error in installing of application database objects:'||
            	 					'Unable to create foreign keys for PMM_TITLEMETADATA.'')';
            EXECUTE IMMEDIATE 'INSERT INTO install_table values ('''||err_msg||''')';
        GOTO bypass_install;
				
		END;
		
		-- CREATE FOREIGN KEYS FOR PMM_TITLE
		BEGIN
			EXECUTE IMMEDIATE 'ALTER TABLE WFS.PMM_TITLE ADD (
                                  CONSTRAINT PMM_TITLE#PMM_TITLE
                                          FOREIGN KEY (ParentID) 
                                          REFERENCES WFS.PMM_TITLE (ID_),
                                  CONSTRAINT PMM_TITLE#PMM_Partner 
                                          FOREIGN KEY (ProviderID) 
                                          REFERENCES WFS.PMM_Partner (ID_),
                                  CONSTRAINT PMM_TITLE#PMM_TITLESTATUS
                                  			FOREIGN KEY (TitleStatusID) 
                                          REFERENCES WFS.PMM_TitleStatus (ID_),
                                  CONSTRAINT PMM_TITLE#PMM_TITLE2
														FOREIGN KEY (RootTitleID) 
														REFERENCES WFS.PMM_TITLE (ID_))';
		EXCEPTION 
			WHEN OTHERS THEN
				wk_message := 'ERROR';
				err_msg :=SUBSTR(SQLERRM, 1, 500);
				EXECUTE IMMEDIATE 'INSERT INTO install_table values(''error in installing of application database objects:'||
            	 					'Unable to create foreign keys for PMM_TITLE.'')';
            EXECUTE IMMEDIATE 'INSERT INTO install_table values ('''||err_msg||''')';
        GOTO bypass_install;
				
		END;
		
		-- CREATE FOREIGN KEYS FOR PMM_TITLELIST
		BEGIN
			EXECUTE IMMEDIATE 'ALTER TABLE WFS.PMM_TITLELIST ADD (
                                  CONSTRAINT PMM_TITLELST#PMM_CONTEXT
                                          FOREIGN KEY (ContextID) 
                                          REFERENCES WFS.PMM_CONTEXT (ID_),
                                  CONSTRAINT PMM_TITLELST#PMM_TTLELSTSTATUS
                                          FOREIGN KEY (TitleListStatusID) 
                                          REFERENCES WFS.PMM_TITLELISTSTATUS (ID_),
                                  CONSTRAINT PMM_TITLELST#PMM_TITLELSTTYPE 
                                          FOREIGN KEY (TitleListTypeID) 
                                          REFERENCES WFS.PMM_LISTTYPE (ID_),
                                  CONSTRAINT PMM_TITLELST#PMM_Partner 
                                          FOREIGN KEY (ProviderID) 
                                          REFERENCES WFS.PMM_PARTNER (ID_))';
		EXCEPTION 
			WHEN OTHERS THEN
				wk_message := 'ERROR';
				err_msg :=SUBSTR(SQLERRM, 1, 500);
				EXECUTE IMMEDIATE 'INSERT INTO install_table values(''error in installing of application database objects:'||
            	 					'Unable to create foreign keys for PMM_TITLELIST.'')';
            EXECUTE IMMEDIATE 'INSERT INTO install_table values ('''||err_msg||''')';
        GOTO bypass_install;
				
		END;
		
		-- CREATE FOREIGN KEYS FOR PMM_TITLE_TITLELISTXREF
		BEGIN
			EXECUTE IMMEDIATE 'ALTER TABLE WFS.PMM_TITLE_TITLELISTXREF ADD (
                                  CONSTRAINT PMM_TTLE_TTLELSTXREF#PMM_TTLE
                                          FOREIGN KEY (TitleID) 
                                          REFERENCES WFS.PMM_TITLE (ID_),
                                  CONSTRAINT PMM_TTLE_TTLELSTX#PMM_TTLELST 
                                          FOREIGN KEY (TitleListID) 
                                          REFERENCES WFS.PMM_TITLELIST (ID_))';
		EXCEPTION 
			WHEN OTHERS THEN
				wk_message := 'ERROR';
				err_msg :=SUBSTR(SQLERRM, 1, 500);
				EXECUTE IMMEDIATE 'INSERT INTO install_table values(''error in installing of application database objects:'||
            	 					'Unable to create foreign keys for PMM_TITLE_TITLELISTXREF .'')';
            EXECUTE IMMEDIATE 'INSERT INTO install_table values ('''||err_msg||''')';
        GOTO bypass_install;
				
		END;
		
		-- CREATE FOREIGN KEYS FOR PMM_PROGRESSITEM
		BEGIN
			EXECUTE IMMEDIATE 'ALTER TABLE WFS.PMM_PROGRESSITEM ADD (
                                  CONSTRAINT PMM_PROGRESSITEM#PMM_TITLE
                                          FOREIGN KEY (TitleID) 
                                          REFERENCES WFS.PMM_TITLE (ID_),
                                  CONSTRAINT PMM_PRGRSITM#JBPM_PRCSSINSTNCE
                                          FOREIGN KEY (ProcessID) 
                                          REFERENCES WFS.JBPM_PROCESSINSTANCE (ID_),
                                  CONSTRAINT PMM_PRGRESSITEM#PMM_TTLELST 
                                          FOREIGN KEY (TitleListID) 
                                          REFERENCES WFS.PMM_TITLELIST (ID_))';
		EXCEPTION 
			WHEN OTHERS THEN
				wk_message := 'ERROR';
				err_msg :=SUBSTR(SQLERRM, 1, 500);
				EXECUTE IMMEDIATE 'INSERT INTO install_table values(''error in installing of application database objects:'||
            	 					'Unable to create foreign keys for PMM_PROGRESSITEM.'')';
            EXECUTE IMMEDIATE 'INSERT INTO install_table values ('''||err_msg||''')';
        GOTO bypass_install;
				
		END;
		
		-- CREATE FOREIGN KEYS FOR PMM_TITLELISTDETAILS
		BEGIN
			EXECUTE IMMEDIATE 'ALTER TABLE WFS.PMM_TITLELISTDETAILS ADD (
                                  CONSTRAINT PMM_TTLEDTLS#PMM_TTLELSTDTLS
                                          FOREIGN KEY (DetailTypeID) 
                                          REFERENCES WFS.PMM_TITLELISTDETAILSTYPE (ID_),
                                  CONSTRAINT PMM_TTLELSTDETAILS#PMM_TTLELST
                                          FOREIGN KEY (TitleListID) 
                                          REFERENCES WFS.PMM_TITLELIST (ID_))';
		EXCEPTION 
			WHEN OTHERS THEN
				wk_message := 'ERROR';
				err_msg :=SUBSTR(SQLERRM, 1, 500);
				EXECUTE IMMEDIATE 'INSERT INTO install_table values(''error in installing of application database objects:'||
            	 					'Unable to create foreign keys for PMM_TITLELISTDETAILS.'')';
            EXECUTE IMMEDIATE 'INSERT INTO install_table values ('''||err_msg||''')';
        GOTO bypass_install;
				
		END;
		
		-- CREATE FOREIGN KEYS FOR PMM_PARTNER
		BEGIN
			EXECUTE IMMEDIATE 'ALTER TABLE WFS.PMM_PARTNER ADD (
                                  CONSTRAINT PMM_PARTNER#PMM_PARTNERTYPE
                                          FOREIGN KEY (PartnerType) 
                                          REFERENCES WFS.PMM_PARTNERTYPE (ID_),
                                  CONSTRAINT PMM_PARTNER#PMM_CONTEXT
                                          FOREIGN KEY (ContextID) 
                                          REFERENCES WFS.PMM_CONTEXT (ID_))';
		EXCEPTION 
			WHEN OTHERS THEN
				wk_message := 'ERROR';
				err_msg :=SUBSTR(SQLERRM, 1, 500);
				EXECUTE IMMEDIATE 'INSERT INTO install_table values(''error in installing of application database objects:'||
            	 					'Unable to create foreign keys for PMM_PARTNER.'')';
            EXECUTE IMMEDIATE 'INSERT INTO install_table values ('''||err_msg||''')';
        GOTO bypass_install;
				
		END;
		
		-- CREATE FOREIGN KEYS FOR PMM_CONTEXT
		BEGIN
			EXECUTE IMMEDIATE 'ALTER TABLE WFS.PMM_CONTEXT ADD (
                                  CONSTRAINT PMM_CONTEXT#PMM_CONTAINERTYPE
                                          FOREIGN KEY (ContainerTypeID) 
                                          REFERENCES WFS.PMM_CONTAINERTYPE (ID_))';
		EXCEPTION 
			WHEN OTHERS THEN
				wk_message := 'ERROR';
				err_msg :=SUBSTR(SQLERRM, 1, 500);
				EXECUTE IMMEDIATE 'INSERT INTO install_table values(''error in installing of application database objects:'||
            	 					'Unable to create foreign keys for PMM_CONTEXT.'')';
            EXECUTE IMMEDIATE 'INSERT INTO install_table values ('''||err_msg||''')';
        GOTO bypass_install;
				
		END;
		
		-- CREATE FOREIGN KEYS FOR PMM_RULE
		BEGIN
			EXECUTE IMMEDIATE 'ALTER TABLE WFS.PMM_RULE ADD (
                                  CONSTRAINT PMM_RULE#PMM_RULETYPE
                                          FOREIGN KEY (RULETYPEID) 
                                          REFERENCES WFS.PMM_RULETYPE (ID_))';
		EXCEPTION 
			WHEN OTHERS THEN
				wk_message := 'ERROR';
				err_msg :=SUBSTR(SQLERRM, 1, 500);
				EXECUTE IMMEDIATE 'INSERT INTO install_table values(''error in installing of application database objects:'||
            	 					'Unable to create foreign keys for PMM_RULE.'')';
            EXECUTE IMMEDIATE 'INSERT INTO install_table values ('''||err_msg||''')';
        GOTO bypass_install;
				
		END;		
		
		-- CREATE FOREIGN KEYS FOR PMM_RuleParameter
		BEGIN
			EXECUTE IMMEDIATE 'ALTER TABLE WFS.PMM_RuleParameter ADD (
                                  CONSTRAINT PMM_RuleParameter#PMM_RULE
                                          FOREIGN KEY (RULEID) 
                                          REFERENCES WFS.PMM_RULE (ID_))';
		EXCEPTION 
			WHEN OTHERS THEN
				wk_message := 'ERROR';
				err_msg :=SUBSTR(SQLERRM, 1, 500);
				EXECUTE IMMEDIATE 'INSERT INTO install_table values(''error in installing of application database objects:'||
            	 					'Unable to create foreign keys for PMM_RuleParameter.'')';
            EXECUTE IMMEDIATE 'INSERT INTO install_table values ('''||err_msg||''')';
        GOTO bypass_install;
				
		END;
		
		-- CREATE FOREIGN KEYS FOR PMM_Service
		BEGIN
			EXECUTE IMMEDIATE 'ALTER TABLE WFS.PMM_Service ADD (
                                  CONSTRAINT PMM_Service#PMM_Context
                                          FOREIGN KEY (ContextID) 
                                          REFERENCES WFS.PMM_CONTEXT (ID_))';
		EXCEPTION 
			WHEN OTHERS THEN
				wk_message := 'ERROR';
				err_msg :=SUBSTR(SQLERRM, 1, 500);
				EXECUTE IMMEDIATE 'INSERT INTO install_table values(''error in installing of application database objects:'||
            	 					'Unable to create foreign keys for PMM_Service.'')';
            EXECUTE IMMEDIATE 'INSERT INTO install_table values ('''||err_msg||''')';
        GOTO bypass_install;
				
		END;
		
		-- CREATE FOREIGN KEYS FOR PMM_Service_PartnerXREF
		BEGIN
			EXECUTE IMMEDIATE 'ALTER TABLE WFS.PMM_Service_PartnerXREF ADD (
                                  CONSTRAINT PMM_Serv_PrtnrXREF#PMM_Service
                                          FOREIGN KEY (ServiceId) 
                                          REFERENCES WFS.PMM_Service (ID_),
                                  CONSTRAINT PMM_Serv_PrtnrXREF#PMM_Partner
                                          FOREIGN KEY (PartnerId) 
                                          REFERENCES WFS.PMM_Partner (ID_))';
		EXCEPTION 
			WHEN OTHERS THEN
				wk_message := 'ERROR';
				err_msg :=SUBSTR(SQLERRM, 1, 500);
				EXECUTE IMMEDIATE 'INSERT INTO install_table values(''error in installing of application database objects:'||
            	 					'Unable to create foreign keys for PMM_Service_PartnerXREF.'')';
            EXECUTE IMMEDIATE 'INSERT INTO install_table values ('''||err_msg||''')';
        GOTO bypass_install;
				
		END;
		
		-- CREATE FOREIGN KEYS FOR PMM_PitchFrequency
		BEGIN
			EXECUTE IMMEDIATE 'ALTER TABLE WFS.PMM_PitchFrequency ADD (
                                  CONSTRAINT PMM_PitchFreq#PMM_Partner1
                                          FOREIGN KEY (SourcePartnerId) 
                                          REFERENCES WFS.PMM_Partner (ID_),
                                  CONSTRAINT PMM_PitchFreq#PMM_Partner2
                                          FOREIGN KEY (DistributionPartnerId) 
                                          REFERENCES WFS.PMM_Partner (ID_))';
		EXCEPTION 
			WHEN OTHERS THEN
				wk_message := 'ERROR';
				err_msg :=SUBSTR(SQLERRM, 1, 500);
				EXECUTE IMMEDIATE 'INSERT INTO install_table values(''error in installing of application database objects:'||
            	 					'Unable to create foreign keys for PMM_PitchFrequency.'')';
            EXECUTE IMMEDIATE 'INSERT INTO install_table values ('''||err_msg||''')';
        GOTO bypass_install;
				
		END;
		
		-- CREATE FOREIGN KEYS FOR PMM_Job
		BEGIN
			EXECUTE IMMEDIATE 'ALTER TABLE WFS.PMM_Job ADD (
                                  CONSTRAINT PMM_Job#PMM_Context
                                          FOREIGN KEY (ContextID) 
                                          REFERENCES WFS.PMM_Context (ID_)
                                          ON DELETE CASCADE,
                                  CONSTRAINT PMM_Job#PMM_RULE
                                          FOREIGN KEY (RuleID) 
                                          REFERENCES WFS.PMM_RULE (ID_),
                                 CONSTRAINT PMM_Job#TTV_PROCESSPRIORITY
                                          FOREIGN KEY (PROCESSPRIORITYID) 
                                          REFERENCES WFS.TTV_PROCESSPRIORITY (PROCESSPRIORITYID))';
		EXCEPTION 
			WHEN OTHERS THEN
				wk_message := 'ERROR';
				err_msg :=SUBSTR(SQLERRM, 1, 500);
				EXECUTE IMMEDIATE 'INSERT INTO install_table values(''error in installing of application database objects:'||
            	 					'Unable to create foreign keys for PMM_Job.'')';
            EXECUTE IMMEDIATE 'INSERT INTO install_table values ('''||err_msg||''')';
        GOTO bypass_install;
				
		END;
		
		-- CREATE FOREIGN KEYS FOR PMM_WatchFolderConfiguration
		BEGIN
			EXECUTE IMMEDIATE 'ALTER TABLE WFS.PMM_WatchFolderConfiguration ADD (
                                  CONSTRAINT PMM_WtchFldCnfig#PMM_Context
                                          FOREIGN KEY (ContextID) 
                                          REFERENCES WFS.PMM_Context (ID_),
                                 CONSTRAINT PMM_WtchFldCnfig#TTV_RESRCE
                                          FOREIGN KEY (ResourceID) 
                                          REFERENCES WFS.TTV_Resource (ResourceID))';
		EXCEPTION 
			WHEN OTHERS THEN
				wk_message := 'ERROR';
				err_msg :=SUBSTR(SQLERRM, 1, 500);
				EXECUTE IMMEDIATE 'INSERT INTO install_table values(''error in installing of application database objects:'||
            	 					'Unable to create foreign keys for PMM_WatchFolderConfiguration.'')';
            EXECUTE IMMEDIATE 'INSERT INTO install_table values ('''||err_msg||''')';
        GOTO bypass_install;
				
		END;
		
		-- CREATE FOREIGN KEYS FOR PMM_JobParameter
		BEGIN
			EXECUTE IMMEDIATE 'ALTER TABLE WFS.PMM_JobParameter ADD (
                                  CONSTRAINT PMM_JobParam#PMM_Job
                                          FOREIGN KEY (JobID) 
                                          REFERENCES WFS.PMM_Job (ID_))';
		EXCEPTION 
			WHEN OTHERS THEN
				wk_message := 'ERROR';
				err_msg :=SUBSTR(SQLERRM, 1, 500);
				EXECUTE IMMEDIATE 'INSERT INTO install_table values(''error in installing of application database objects:'||
            	 					'Unable to create foreign keys for PMM_JobParameter.'')';
            EXECUTE IMMEDIATE 'INSERT INTO install_table values ('''||err_msg||''')';
        GOTO bypass_install;
				
		END;
		
		-- CREATE FOREIGN KEYS FOR PMM_RuleTypeParameter
		BEGIN
			EXECUTE IMMEDIATE 'ALTER TABLE WFS.PMM_RuleTypeParameter ADD (
                                  CONSTRAINT RulTypeParm#RulTypeParmDtaType
                                          FOREIGN KEY (DataTypeID) 
                                          REFERENCES WFS.PMM_RULETYPEPARAMETERDATATYPE (ID_),
                                   CONSTRAINT RulTypeParm#PMM_RULETYPE
                                          FOREIGN KEY (RULETYPEID ) 
                                          REFERENCES WFS.PMM_RULETYPE (ID_))';
		EXCEPTION 
			WHEN OTHERS THEN
				wk_message := 'ERROR';
				err_msg :=SUBSTR(SQLERRM, 1, 500);
				EXECUTE IMMEDIATE 'INSERT INTO install_table values(''error in installing of application database objects:'||
            	 					'Unable to create foreign keys for PMM_RuleTypeParameter.'')';
            EXECUTE IMMEDIATE 'INSERT INTO install_table values ('''||err_msg||''')';
        GOTO bypass_install;
				
		END;
		
		-- CREATE FOREIGN KEYS FOR PMM_Contact 
		BEGIN
			EXECUTE IMMEDIATE 'ALTER TABLE WFS.PMM_Contact ADD (
                                  CONSTRAINT PMM_Contact#PMM_Partner
                                          FOREIGN KEY (PARTNERID) 
                                          REFERENCES WFS.PMM_Partner (ID_))';
		EXCEPTION 
			WHEN OTHERS THEN
				wk_message := 'ERROR';
				err_msg :=SUBSTR(SQLERRM, 1, 500);
				EXECUTE IMMEDIATE 'INSERT INTO install_table values(''error in installing of application database objects:'||
            	 					'Unable to create foreign keys for PMM_Contact.'')';
            EXECUTE IMMEDIATE 'INSERT INTO install_table values ('''||err_msg||''')';
        GOTO bypass_install;
				
		END;
		
		-- CREATE FOREIGN KEYS FOR PMM_PROPERTIES 
		BEGIN
			EXECUTE IMMEDIATE 'ALTER TABLE WFS.PMM_PROPERTIES ADD (
                                  CONSTRAINT PMM_PROP#PMM_TITLE
                                          FOREIGN KEY (TITLEID) 
                                          REFERENCES WFS.PMM_Title (ID_),
                                  CONSTRAINT PMM_PROP#PMM_TitleList
                                          FOREIGN KEY (TitleListId) 
                                          REFERENCES WFS.PMM_TitleList (ID_),
                                  CONSTRAINT PMM_PROP#PMM_Context
                                          FOREIGN KEY (ContextId) 
                                          REFERENCES WFS.PMM_Context (ID_))';
		EXCEPTION 
			WHEN OTHERS THEN
				wk_message := 'ERROR';
				err_msg :=SUBSTR(SQLERRM, 1, 500);
				EXECUTE IMMEDIATE 'INSERT INTO install_table values(''error in installing of application database objects:'||
            	 					'Unable to create foreign keys for PMM_Contact.'')';
            EXECUTE IMMEDIATE 'INSERT INTO install_table values ('''||err_msg||''')';
        GOTO bypass_install;
				
		END;
	
		<<bypass_install>>
  
          COMMIT;
          
          IF wk_message = 'ERROR' THEN
          
             NULL;
             
          ELSE
          
             EXECUTE IMMEDIATE 'INSERT INTO install_table values
           (''Installation of PMM completed SUCCESSFULLY'')';
             
          END IF;
		
	END;
/
