text: ALTER TABLE B_DP_STATUS ADD COLUMN DP_MODE INT AFTER DP_TYPE;
  ALTER TABLE B_DP_STATUS ADD COLUMN ABOLISHED_TYPE INT AFTER DP_MODE;
  UPDATE B_DP_STATUS SET DP_MODE=1;
  UPDATE B_DP_STATUS SET ABOLISHED_TYPE=IMPORT_TYPE;
  ALTER TABLE B_DP_STATUS DROP COLUMN IMPORT_TYPE;
  
  ALTER TABLE B_DP_STATUS_JNL ADD COLUMN DP_MODE INT AFTER DP_TYPE;
  ALTER TABLE B_DP_STATUS_JNL ADD COLUMN ABOLISHED_TYPE INT AFTER DP_MODE;
  UPDATE B_DP_STATUS_JNL SET DP_MODE=1;
  UPDATE B_DP_STATUS_JNL SET ABOLISHED_TYPE=IMPORT_TYPE;
  ALTER TABLE B_DP_STATUS_JNL DROP COLUMN IMPORT_TYPE;
  
  
  CREATE TABLE B_DP_MODE
  (
  ROW_ID                            INT                               , -- 識別シーケンス
  DP_MODE                           VARCHAR (100)                     , -- モード
  ACCESS_AUTH                       TEXT                              ,
  NOTE                              VARCHAR (4000)                    , -- 備考
  DISUSE_FLAG                       VARCHAR (1)                       , -- 廃止フラグ
  LAST_UPDATE_TIMESTAMP             DATETIME(6)                       , -- 最終更新日時
  LAST_UPDATE_USER                  INT                               , -- 最終更新ユーザ
  PRIMARY KEY (ROW_ID)
  )ENGINE = InnoDB, CHARSET = utf8, COLLATE = utf8_bin, ROW_FORMAT=COMPRESSED ,KEY_BLOCK_SIZE=8;
  
  CREATE TABLE B_DP_ABOLISHED_TYPE
  (
  ROW_ID                            INT                               , -- 識別シーケンス
  ABOLISHED_TYPE                    VARCHAR (100)                     , -- 廃止情報
  ACCESS_AUTH                       TEXT                              ,
  NOTE                              VARCHAR (4000)                    , -- 備考
  DISUSE_FLAG                       VARCHAR (1)                       , -- 廃止フラグ
  LAST_UPDATE_TIMESTAMP             DATETIME(6)                       , -- 最終更新日時
  LAST_UPDATE_USER                  INT                               , -- 最終更新ユーザ
  PRIMARY KEY (ROW_ID)
  )ENGINE = InnoDB, CHARSET = utf8, COLLATE = utf8_bin, ROW_FORMAT=COMPRESSED ,KEY_BLOCK_SIZE=8;
  
  
  ALTER TABLE C_REGULARLY_LIST ADD COLUMN EXECUTION_USER_ID INT AFTER PATTERN_WEEK_NUMBER;
  
  ALTER TABLE C_REGULARLY_LIST_JNL ADD COLUMN EXECUTION_USER_ID INT AFTER PATTERN_WEEK_NUMBER;
  
  UPDATE C_REGULARLY_LIST TAB_1 SET EXECUTION_USER_ID=(SELECT LAST_UPDATE_USER FROM C_REGULARLY_LIST_JNL WHERE REGULARLY_ID=TAB_1.REGULARLY_ID AND JOURNAL_SEQ_NO = (SELECT MAX(JOURNAL_SEQ_NO) FROM C_REGULARLY_LIST_JNL WHERE REGULARLY_ID=TAB_1.REGULARLY_ID AND LAST_UPDATE_USER > 0));
  
  UPDATE C_REGULARLY_LIST TAB_A 
  SET EXECUTION_USER_ID=(SELECT LAST_UPDATE_USER 
                         FROM  C_REGULARLY_LIST_JNL
                         WHERE TAB_A.REGULARLY_ID=REGULARLY_ID AND JOURNAL_SEQ_NO=(SELECT MAX(JOURNAL_SEQ_NO) 
                                                                                   FROM C_REGULARLY_LIST_JNL 
                                                                                   WHERE TAB_A.REGULARLY_ID=REGULARLY_ID AND LAST_UPDATE_USER <> -5
                                                                                  )
                        );
  
  
  ALTER TABLE C_REGULARLY2_LIST ADD COLUMN EXECUTION_USER_ID INT AFTER PATTERN_WEEK_NUMBER;
  
  ALTER TABLE C_REGULARLY2_LIST_JNL ADD COLUMN EXECUTION_USER_ID INT AFTER PATTERN_WEEK_NUMBER;
  
  UPDATE C_REGULARLY2_LIST TAB_1 SET EXECUTION_USER_ID=(SELECT LAST_UPDATE_USER FROM C_REGULARLY2_LIST_JNL WHERE REGULARLY_ID=TAB_1.REGULARLY_ID AND JOURNAL_SEQ_NO = (SELECT MAX(JOURNAL_SEQ_NO) FROM C_REGULARLY2_LIST_JNL WHERE REGULARLY_ID=TAB_1.REGULARLY_ID AND LAST_UPDATE_USER > 0));
  
  UPDATE C_REGULARLY2_LIST TAB_A 
  SET EXECUTION_USER_ID=(SELECT LAST_UPDATE_USER 
                         FROM  C_REGULARLY2_LIST_JNL
                         WHERE TAB_A.REGULARLY_ID=REGULARLY_ID AND JOURNAL_SEQ_NO=(SELECT MAX(JOURNAL_SEQ_NO) 
                                                                                   FROM C_REGULARLY2_LIST_JNL 
                                                                                   WHERE TAB_A.REGULARLY_ID=REGULARLY_ID AND LAST_UPDATE_USER <> -5
                                                                                  )
                        );
  
  
  CREATE OR REPLACE VIEW D_ACCOUNT_LIST AS 
  SELECT TAB_A.USER_ID              ,
         TAB_A.USERNAME             ,
         TAB_A.PASSWORD             ,
         TAB_A.USERNAME_JP          ,
         TAB_A.MAIL_ADDRESS         ,
         TAB_A.PW_LAST_UPDATE_TIME  ,
         TAB_B.LOCK_ID              ,
         TAB_B.MISS_INPUT_COUNTER   ,
         TAB_B.LOCKED_TIMESTAMP     ,
         CONCAT(TAB_A.USER_ID,':',TAB_A.USERNAME) USER_PULLDOWN,
         TAB_C.USER_JUDGE_ID        ,
         TAB_C.AD_USER_SID          ,
         TAB_A.AUTH_TYPE            ,
         TAB_A.PROVIDER_ID          ,
         TAB_A.PROVIDER_USER_ID     ,
         TAB_A.ACCESS_AUTH          ,
         TAB_C.ACCESS_AUTH AS ACCESS_AUTH_01,
         TAB_A.NOTE                 ,
         TAB_A.DISUSE_FLAG          ,
         TAB_A.LAST_UPDATE_TIMESTAMP,
         TAB_A.LAST_UPDATE_USER
  FROM   A_ACCOUNT_LIST TAB_A
  LEFT JOIN A_ACCOUNT_LOCK TAB_B ON (TAB_A.USER_ID = TAB_B.USER_ID)
  LEFT JOIN A_AD_USER_JUDGEMENT TAB_C ON (TAB_A.USER_ID = TAB_C.ITA_USER_ID)
  WHERE  TAB_A.USER_ID > 0;
  
  
  CREATE OR REPLACE VIEW D_ACCOUNT_LIST_JNL AS 
  SELECT TAB_A.JOURNAL_SEQ_NO       ,
         TAB_A.JOURNAL_REG_DATETIME ,
         TAB_A.JOURNAL_ACTION_CLASS ,
         TAB_A.USER_ID              ,
         TAB_A.USERNAME             ,
         TAB_A.PASSWORD             ,
         TAB_A.USERNAME_JP          ,
         TAB_A.MAIL_ADDRESS         ,
         TAB_A.PW_LAST_UPDATE_TIME  ,
         TAB_B.LOCK_ID              ,
         TAB_B.MISS_INPUT_COUNTER   ,
         TAB_B.LOCKED_TIMESTAMP     ,
         CONCAT(TAB_A.USER_ID,':',TAB_A.USERNAME) USER_PULLDOWN,
         TAB_C.USER_JUDGE_ID        ,
         TAB_C.AD_USER_SID          ,
         TAB_A.AUTH_TYPE            ,
         TAB_A.PROVIDER_ID          ,
         TAB_A.PROVIDER_USER_ID     ,
         TAB_A.ACCESS_AUTH          ,
         TAB_C.ACCESS_AUTH AS ACCESS_AUTH_01,
         TAB_A.NOTE                 ,
         TAB_A.DISUSE_FLAG          ,
         TAB_A.LAST_UPDATE_TIMESTAMP,
         TAB_A.LAST_UPDATE_USER
  FROM   A_ACCOUNT_LIST_JNL TAB_A
  LEFT JOIN A_ACCOUNT_LOCK TAB_B ON (TAB_A.USER_ID = TAB_B.USER_ID)
  LEFT JOIN A_AD_USER_JUDGEMENT TAB_C ON (TAB_A.USER_ID = TAB_C.ITA_USER_ID)
  WHERE  TAB_A.USER_ID > 0;
  
  
  CREATE OR REPLACE VIEW D_ROLE_LIST AS 
  SELECT TAB_A.ROLE_ID              ,
         TAB_A.ROLE_NAME            ,
         TAB_A.ROLE_ID                ROLE_ID_CLONE,
         CONCAT(TAB_A.ROLE_ID,':',TAB_A.ROLE_NAME) ROLE_PULLDOWN,
         TAB_B.GROUP_JUDGE_ID       ,
         TAB_B.AD_GROUP_SID         ,
         TAB_A.ACCESS_AUTH          ,
         TAB_A.NOTE                 ,
         TAB_A.DISUSE_FLAG          ,
         TAB_A.LAST_UPDATE_TIMESTAMP,
         TAB_A.LAST_UPDATE_USER     ,
         TAB_B.ACCESS_AUTH AS ACCESS_AUTH_01   
  FROM   A_ROLE_LIST TAB_A
  LEFT JOIN A_AD_GROUP_JUDGEMENT TAB_B ON (TAB_A.ROLE_ID = TAB_B.ITA_ROLE_ID);
  
  
  CREATE OR REPLACE VIEW D_ROLE_LIST_JNL AS 
  SELECT TAB_A.JOURNAL_SEQ_NO       ,
         TAB_A.JOURNAL_REG_DATETIME ,
         TAB_A.JOURNAL_ACTION_CLASS ,
         TAB_A.ROLE_ID              ,
         TAB_A.ROLE_NAME            ,
         TAB_A.ROLE_ID                ROLE_ID_CLONE,
         CONCAT(TAB_A.ROLE_ID,':',TAB_A.ROLE_NAME) ROLE_PULLDOWN,
         TAB_B.GROUP_JUDGE_ID       ,
         TAB_B.AD_GROUP_SID         ,
         TAB_A.ACCESS_AUTH          ,
         TAB_A.NOTE                 ,
         TAB_A.DISUSE_FLAG          ,
         TAB_A.LAST_UPDATE_TIMESTAMP,
         TAB_A.LAST_UPDATE_USER     ,
         TAB_B.ACCESS_AUTH AS ACCESS_AUTH_01   
  FROM   A_ROLE_LIST_JNL TAB_A
  LEFT JOIN A_AD_GROUP_JUDGEMENT TAB_B ON (TAB_A.ROLE_ID = TAB_B.ITA_ROLE_ID);
  
  
  CREATE OR REPLACE VIEW D_MENU_LIST AS 
  SELECT TAB_A.MENU_ID              ,
         TAB_A.MENU_GROUP_ID        ,
         TAB_B.MENU_GROUP_NAME      ,
         TAB_A.MENU_GROUP_ID          MENU_GROUP_ID_CLONE,
         TAB_A.MENU_GROUP_ID          MENU_GROUP_ID_CLONE_02,
         TAB_A.MENU_NAME            ,
         CONCAT(TAB_A.MENU_GROUP_ID,':',TAB_B.MENU_GROUP_NAME,':',TAB_A.MENU_ID,':',TAB_A.MENU_NAME) MENU_PULLDOWN,
         TAB_A.LOGIN_NECESSITY      ,
         TAB_A.SERVICE_STATUS       ,
         TAB_A.AUTOFILTER_FLG       ,
         TAB_A.INITIAL_FILTER_FLG   ,
         TAB_A.WEB_PRINT_LIMIT      ,
         TAB_A.WEB_PRINT_CONFIRM    ,
         TAB_A.XLS_PRINT_LIMIT      ,
         TAB_A.DISP_SEQ             ,
         TAB_A.ACCESS_AUTH          ,
         TAB_A.NOTE                 ,
         TAB_A.DISUSE_FLAG          ,
         TAB_A.LAST_UPDATE_TIMESTAMP,
         TAB_A.LAST_UPDATE_USER     ,
         TAB_B.ACCESS_AUTH AS ACCESS_AUTH_01
  FROM   A_MENU_LIST TAB_A
  LEFT JOIN A_MENU_GROUP_LIST TAB_B ON (TAB_A.MENU_GROUP_ID = TAB_B.MENU_GROUP_ID);
  
  
  CREATE OR REPLACE VIEW D_MENU_LIST_JNL AS 
  SELECT TAB_A.JOURNAL_SEQ_NO       ,
         TAB_A.JOURNAL_REG_DATETIME ,
         TAB_A.JOURNAL_ACTION_CLASS ,
         TAB_A.MENU_ID              ,
         TAB_A.MENU_GROUP_ID        ,
         TAB_B.MENU_GROUP_NAME      ,
         TAB_A.MENU_GROUP_ID          MENU_GROUP_ID_CLONE,
         TAB_A.MENU_GROUP_ID          MENU_GROUP_ID_CLONE_02,
         TAB_A.MENU_NAME            ,
         CONCAT(TAB_A.MENU_GROUP_ID,':',TAB_B.MENU_GROUP_NAME,':',TAB_A.MENU_ID,':',TAB_A.MENU_NAME) MENU_PULLDOWN,
         TAB_A.LOGIN_NECESSITY      ,
         TAB_A.SERVICE_STATUS       ,
         TAB_A.AUTOFILTER_FLG       ,
         TAB_A.INITIAL_FILTER_FLG   ,
         TAB_A.WEB_PRINT_LIMIT      ,
         TAB_A.WEB_PRINT_CONFIRM    ,
         TAB_A.XLS_PRINT_LIMIT      ,
         TAB_A.DISP_SEQ             ,
         TAB_A.ACCESS_AUTH          ,
         TAB_A.NOTE                 ,
         TAB_A.DISUSE_FLAG          ,
         TAB_A.LAST_UPDATE_TIMESTAMP,
         TAB_A.LAST_UPDATE_USER     ,
         TAB_B.ACCESS_AUTH AS ACCESS_AUTH_01
  FROM   A_MENU_LIST_JNL TAB_A
  LEFT JOIN A_MENU_GROUP_LIST TAB_B ON (TAB_A.MENU_GROUP_ID = TAB_B.MENU_GROUP_ID);
  
  
  CREATE OR REPLACE VIEW D_ROLE_MENU_LINK_LIST AS 
  SELECT TAB_A.LINK_ID              ,
         TAB_A.ROLE_ID              ,
         TAB_D.ROLE_NAME            ,
         TAB_A.ROLE_ID                ROLE_ID_CLONE,
         TAB_A.ROLE_ID                ROLE_ID_CLONE_02,
         TAB_B.MENU_GROUP_ID        ,
         TAB_B.MENU_GROUP_ID          MENU_GROUP_ID_CLONE,
         TAB_C.MENU_GROUP_NAME      ,
         TAB_A.MENU_ID              ,
         TAB_B.MENU_NAME            ,
         TAB_A.MENU_ID                MENU_ID_CLONE,
         TAB_A.MENU_ID                MENU_ID_CLONE_02,
         TAB_A.PRIVILEGE            ,
         TAB_A.ACCESS_AUTH          ,
         TAB_A.NOTE                 ,
         TAB_A.DISUSE_FLAG          ,
         TAB_A.LAST_UPDATE_TIMESTAMP,
         TAB_A.LAST_UPDATE_USER 
  FROM A_ROLE_MENU_LINK_LIST TAB_A
  LEFT JOIN A_MENU_LIST TAB_B ON (TAB_A.MENU_ID = TAB_B.MENU_ID)
  LEFT JOIN A_MENU_GROUP_LIST TAB_C ON (TAB_B.MENU_GROUP_ID = TAB_C.MENU_GROUP_ID)
  LEFT JOIN A_ROLE_LIST TAB_D ON (TAB_A.ROLE_ID = TAB_D.ROLE_ID);
  
  
  CREATE OR REPLACE VIEW D_ROLE_MENU_LINK_LIST_JNL AS 
  SELECT TAB_A.JOURNAL_SEQ_NO       ,
         TAB_A.JOURNAL_REG_DATETIME ,
         TAB_A.JOURNAL_ACTION_CLASS ,
         TAB_A.LINK_ID              ,
         TAB_A.ROLE_ID              ,
         TAB_D.ROLE_NAME            ,
         TAB_A.ROLE_ID                ROLE_ID_CLONE,
         TAB_A.ROLE_ID                ROLE_ID_CLONE_02,
         TAB_B.MENU_GROUP_ID        ,
         TAB_B.MENU_GROUP_ID          MENU_GROUP_ID_CLONE,
         TAB_C.MENU_GROUP_NAME      ,
         TAB_A.MENU_ID              ,
         TAB_B.MENU_NAME            ,
         TAB_A.MENU_ID                MENU_ID_CLONE,
         TAB_A.MENU_ID                MENU_ID_CLONE_02,
         TAB_A.PRIVILEGE            ,
         TAB_A.ACCESS_AUTH          ,
         TAB_A.NOTE                 ,
         TAB_A.DISUSE_FLAG          ,
         TAB_A.LAST_UPDATE_TIMESTAMP,
         TAB_A.LAST_UPDATE_USER 
  FROM A_ROLE_MENU_LINK_LIST_JNL TAB_A
  LEFT JOIN A_MENU_LIST TAB_B ON (TAB_A.MENU_ID = TAB_B.MENU_ID)
  LEFT JOIN A_MENU_GROUP_LIST TAB_C ON (TAB_B.MENU_GROUP_ID = TAB_C.MENU_GROUP_ID)
  LEFT JOIN A_ROLE_LIST TAB_D ON (TAB_A.ROLE_ID = TAB_D.ROLE_ID);
  
  
  CREATE OR REPLACE VIEW D_ROLE_ACCOUNT_LINK_LIST AS 
  SELECT TAB_A.LINK_ID              ,
         TAB_A.ROLE_ID              ,
         TAB_C.ROLE_NAME            ,
         TAB_A.ROLE_ID                ROLE_ID_CLONE,
         TAB_A.ROLE_ID                ROLE_ID_CLONE_02,
         TAB_A.USER_ID              ,
         TAB_B.USERNAME             ,
         TAB_A.USER_ID                USER_ID_CLONE,
         TAB_A.USER_ID                USER_ID_CLONE_02,
         TAB_A.DEF_ACCESS_AUTH_FLAG ,
         TAB_A.ACCESS_AUTH          ,
         TAB_A.NOTE                 ,
         TAB_A.DISUSE_FLAG          ,
         TAB_A.LAST_UPDATE_TIMESTAMP,
         TAB_A.LAST_UPDATE_USER 
  FROM A_ROLE_ACCOUNT_LINK_LIST TAB_A
  LEFT JOIN A_ACCOUNT_LIST TAB_B ON (TAB_A.USER_ID = TAB_B.USER_ID)
  LEFT JOIN A_ROLE_LIST TAB_C ON (TAB_A.ROLE_ID = TAB_C.ROLE_ID)
  WHERE TAB_A.USER_ID > 0;
  
  
  CREATE OR REPLACE VIEW D_ROLE_ACCOUNT_LINK_LIST_JNL AS 
  SELECT TAB_A.JOURNAL_SEQ_NO       ,
         TAB_A.JOURNAL_REG_DATETIME ,
         TAB_A.JOURNAL_ACTION_CLASS ,
         TAB_A.LINK_ID              ,
         TAB_A.ROLE_ID              ,
         TAB_C.ROLE_NAME            ,
         TAB_A.ROLE_ID                ROLE_ID_CLONE,
         TAB_A.ROLE_ID                ROLE_ID_CLONE_02,
         TAB_A.USER_ID              ,
         TAB_B.USERNAME             ,
         TAB_A.USER_ID                USER_ID_CLONE,
         TAB_A.USER_ID                USER_ID_CLONE_02,
         TAB_A.DEF_ACCESS_AUTH_FLAG ,
         TAB_A.ACCESS_AUTH          ,
         TAB_A.NOTE                 ,
         TAB_A.DISUSE_FLAG          ,
         TAB_A.LAST_UPDATE_TIMESTAMP,
         TAB_A.LAST_UPDATE_USER 
  FROM A_ROLE_ACCOUNT_LINK_LIST_JNL TAB_A
  LEFT JOIN A_ACCOUNT_LIST TAB_B ON (TAB_A.USER_ID = TAB_B.USER_ID)
  LEFT JOIN A_ROLE_LIST TAB_C ON (TAB_A.ROLE_ID = TAB_C.ROLE_ID)
  WHERE TAB_A.USER_ID > 0;
  
  
  CREATE OR REPLACE VIEW G_PARAM_TARGET AS 
  SELECT TAB_A.TARGET_ID              ,
         TAB_A.DISP_SEQ               ,
         TAB_A.TARGET_NAME            ,
         TAB_A.ACCESS_AUTH            ,
         TAB_A.NOTE                   ,
         TAB_A.DISUSE_FLAG            ,
         TAB_A.LAST_UPDATE_TIMESTAMP  ,
         TAB_A.LAST_UPDATE_USER
  FROM F_PARAM_TARGET TAB_A
  WHERE TAB_A.TARGET_ID IN (1,2,3);
  
  CREATE OR REPLACE VIEW G_PARAM_TARGET_JNL AS 
  SELECT TAB_A.JOURNAL_SEQ_NO         ,
         TAB_A.JOURNAL_REG_DATETIME   ,
         TAB_A.JOURNAL_ACTION_CLASS   ,
         TAB_A.TARGET_ID              ,
         TAB_A.DISP_SEQ               ,
         TAB_A.TARGET_NAME            ,
         TAB_A.ACCESS_AUTH            ,
         TAB_A.NOTE                   ,
         TAB_A.DISUSE_FLAG            ,
         TAB_A.LAST_UPDATE_TIMESTAMP  ,
         TAB_A.LAST_UPDATE_USER
  FROM F_PARAM_TARGET_JNL TAB_A
  WHERE TAB_A.TARGET_ID IN (1,2,3);
  
  
  CREATE OR REPLACE VIEW D_SEQUENCE AS 
  SELECT TAB_A.NAME                 ,
         TAB_A.VALUE                ,
         TAB_A.MENU_ID              ,
         TAB_B.MENU_GROUP_ID        ,
         TAB_B.MENU_NAME            ,
         TAB_B.MENU_GROUP_NAME      ,
         TAB_A.DISP_SEQ             ,
         TAB_A.NOTE                 ,
         '0' as DISUSE_FLAG         ,
         TAB_A.LAST_UPDATE_TIMESTAMP
  FROM A_SEQUENCE  as TAB_A
       LEFT JOIN D_MENU_LIST as TAB_B on TAB_A.MENU_ID = TAB_B.MENU_ID
  WHERE TAB_A.MENU_ID IS NOT NULL AND
        TAB_B.DISUSE_FLAG = '0';
  
  
  CREATE OR REPLACE VIEW D_CMDB_MENU_LIST AS 
  SELECT 
         TAB_A.MENU_LIST_ID                   , -- 識別シーケンス
         TAB_A.MENU_ID                        , -- メニューID
         TAB_B.MENU_GROUP_ID                  ,
         TAB_B.MENU_GROUP_ID     MENU_GROUP_ID_CLONE,
         TAB_C.MENU_GROUP_NAME                ,
         TAB_A.MENU_ID           MENU_ID_CLONE,
         TAB_A.MENU_ID           MENU_ID_CLONE_02,
         TAB_B.MENU_NAME                      ,
         CONCAT(TAB_B.MENU_GROUP_ID,':',TAB_C.MENU_GROUP_NAME,':',TAB_A.MENU_ID,':',TAB_B.MENU_NAME) MENU_PULLDOWN,
         TAB_A.SHEET_TYPE                     ,
         TAB_A.ACCESS_AUTH_FLG                ,
         TAB_A.DISP_SEQ                       ,
         TAB_A.ACCESS_AUTH                    ,
         TAB_A.NOTE                           ,
         TAB_A.DISUSE_FLAG                    ,
         TAB_A.LAST_UPDATE_TIMESTAMP          ,
         TAB_A.LAST_UPDATE_USER               ,
         TAB_B.ACCESS_AUTH AS ACCESS_AUTH_01  ,
         TAB_C.ACCESS_AUTH AS ACCESS_AUTH_02 
  FROM B_CMDB_MENU_LIST TAB_A
  LEFT JOIN A_MENU_LIST TAB_B ON (TAB_A.MENU_ID = TAB_B.MENU_ID)
  LEFT JOIN A_MENU_GROUP_LIST TAB_C ON (TAB_B.MENU_GROUP_ID = TAB_C.MENU_GROUP_ID)
  WHERE TAB_B.DISUSE_FLAG = '0'
  ;
  
  
  CREATE OR REPLACE VIEW D_CMDB_MENU_LIST_JNL AS 
  SELECT TAB_A.JOURNAL_SEQ_NO                 ,
         TAB_A.JOURNAL_REG_DATETIME           ,
         TAB_A.JOURNAL_ACTION_CLASS           ,
         TAB_A.MENU_LIST_ID                   , -- 識別シーケンス
         TAB_A.MENU_ID                        , -- メニューID
         TAB_B.MENU_GROUP_ID                  ,
         TAB_B.MENU_GROUP_ID     MENU_GROUP_ID_CLONE,
         TAB_C.MENU_GROUP_NAME                ,
         TAB_A.MENU_ID           MENU_ID_CLONE,
         TAB_A.MENU_ID           MENU_ID_CLONE_02,
         TAB_B.MENU_NAME                      ,
         CONCAT(TAB_B.MENU_GROUP_ID,':',TAB_C.MENU_GROUP_NAME,':',TAB_A.MENU_ID,':',TAB_B.MENU_NAME) MENU_PULLDOWN,
         TAB_A.SHEET_TYPE                     ,
         TAB_A.ACCESS_AUTH_FLG                ,
         TAB_A.DISP_SEQ                       ,
         TAB_A.ACCESS_AUTH                    ,
         TAB_A.NOTE                           ,
         TAB_A.DISUSE_FLAG                    ,
         TAB_A.LAST_UPDATE_TIMESTAMP          ,
         TAB_A.LAST_UPDATE_USER               ,
         TAB_B.ACCESS_AUTH AS ACCESS_AUTH_01  ,
         TAB_C.ACCESS_AUTH AS ACCESS_AUTH_02 
  FROM B_CMDB_MENU_LIST_JNL TAB_A
  LEFT JOIN A_MENU_LIST TAB_B ON (TAB_A.MENU_ID = TAB_B.MENU_ID)
  LEFT JOIN A_MENU_GROUP_LIST TAB_C ON (TAB_B.MENU_GROUP_ID = TAB_C.MENU_GROUP_ID)
  WHERE TAB_B.DISUSE_FLAG = '0'
  ;
  
  
  CREATE OR REPLACE VIEW D_CMDB_TARGET_MENU_LIST AS 
  SELECT 
    TAB_A.MENU_ID,
    TAB_A.MENU_NAME,
    TAB_B.MENU_GROUP_ID,
    TAB_B.MENU_GROUP_NAME,
    CONCAT(TAB_B.MENU_GROUP_ID,':',TAB_B.MENU_GROUP_NAME,':',TAB_A.MENU_ID,':',TAB_A.MENU_NAME) MENU_PULLDOWN,
    TAB_A.DISUSE_FLAG,
    TAB_A.ACCESS_AUTH,
    TAB_B.ACCESS_AUTH AS ACCESS_AUTH_01
  FROM 
    ( A_MENU_LIST TAB_A
      INNER JOIN A_MENU_GROUP_LIST TAB_B ON TAB_B.MENU_GROUP_ID = TAB_A.MENU_GROUP_ID )
  WHERE
    TAB_A.DISUSE_FLAG = '0'
  AND TAB_B.DISUSE_FLAG = '0'
  AND TAB_B.MENU_GROUP_ID IN (SELECT MENU_GROUP_ID FROM D_CMDB_MENU_GRP_LIST)
  ;
  
  
  CREATE OR REPLACE VIEW D_CMDB_TARGET_MENU_LIST_JNL AS 
  SELECT 
    TAB_A.MENU_ID,
    TAB_A.MENU_NAME,
    TAB_B.MENU_GROUP_ID,
    TAB_B.MENU_GROUP_NAME,
    CONCAT(TAB_B.MENU_GROUP_ID,':',TAB_B.MENU_GROUP_NAME,':',TAB_A.MENU_ID,':',TAB_A.MENU_NAME) MENU_PULLDOWN,
    TAB_A.DISUSE_FLAG,
    TAB_A.ACCESS_AUTH,
    TAB_B.ACCESS_AUTH AS ACCESS_AUTH_01
  FROM 
    ( A_MENU_LIST_JNL TAB_A
      INNER JOIN A_MENU_GROUP_LIST TAB_B ON TAB_B.MENU_GROUP_ID = TAB_A.MENU_GROUP_ID )
  WHERE
    TAB_A.DISUSE_FLAG = '0'
  AND TAB_B.DISUSE_FLAG = '0'
  AND TAB_B.MENU_GROUP_ID IN (SELECT MENU_GROUP_ID FROM D_CMDB_MENU_GRP_LIST)
  ;
  
  
  CREATE OR REPLACE VIEW D_CMDB_MG_MU_COL_LIST AS 
  SELECT
    TAB_A.COLUMN_LIST_ID                 , 
    CONCAT(TAB_D.MENU_GROUP_ID,':',TAB_D.MENU_GROUP_NAME,':',TAB_C.MENU_ID,':',TAB_C.MENU_NAME,':',TAB_A.COLUMN_LIST_ID,':',TAB_A.COL_TITLE) MENU_COL_TITLE_PULLDOWN,
    TAB_C.MENU_ID                        ,
    TAB_B.SHEET_TYPE                     ,
    TAB_A.COL_TITLE_DISP_SEQ             ,
    TAB_A.DISP_SEQ                       ,
    TAB_A.ACCESS_AUTH                    ,
    TAB_A.NOTE                           ,
    TAB_A.DISUSE_FLAG                    ,
    TAB_A.LAST_UPDATE_TIMESTAMP          ,
    TAB_A.LAST_UPDATE_USER               ,
    TAB_B.ACCESS_AUTH AS ACCESS_AUTH_01  ,
    TAB_C.ACCESS_AUTH AS ACCESS_AUTH_02  ,
    TAB_D.ACCESS_AUTH AS ACCESS_AUTH_03
  FROM        B_CMDB_MENU_COLUMN TAB_A
    LEFT JOIN B_CMDB_MENU_LIST       TAB_B ON (TAB_A.MENU_ID       = TAB_B.MENU_ID)
    LEFT JOIN A_MENU_LIST            TAB_C ON (TAB_A.MENU_ID       = TAB_C.MENU_ID)
    LEFT JOIN A_MENU_GROUP_LIST      TAB_D ON (TAB_C.MENU_GROUP_ID = TAB_D.MENU_GROUP_ID)
  WHERE
     TAB_A.DISUSE_FLAG = '0' AND
     TAB_B.DISUSE_FLAG = '0' AND
     TAB_C.DISUSE_FLAG = '0' AND
     TAB_D.DISUSE_FLAG = '0';
  
  
  CREATE OR REPLACE VIEW D_CMDB_MG_MU_COL_LIST_JNL AS 
  SELECT 
    TAB_A.COLUMN_LIST_ID                 , 
    CONCAT(TAB_D.MENU_GROUP_ID,':',TAB_D.MENU_GROUP_NAME,':',TAB_C.MENU_ID,':',TAB_C.MENU_NAME,':',TAB_A.COLUMN_LIST_ID,':',TAB_A.COL_TITLE) MENU_COL_PULLDOWN,
    TAB_C.MENU_ID                        ,
    TAB_B.SHEET_TYPE                     ,
    TAB_A.COL_TITLE_DISP_SEQ             ,
    TAB_A.DISP_SEQ                       ,
    TAB_A.ACCESS_AUTH                    ,
    TAB_A.NOTE                           ,
    TAB_A.DISUSE_FLAG                    ,
    TAB_A.LAST_UPDATE_TIMESTAMP          ,
    TAB_A.LAST_UPDATE_USER               ,
    TAB_B.ACCESS_AUTH AS ACCESS_AUTH_01  ,
    TAB_C.ACCESS_AUTH AS ACCESS_AUTH_02  ,
    TAB_D.ACCESS_AUTH AS ACCESS_AUTH_03
  FROM        B_CMDB_MENU_COLUMN_JNL TAB_A
    LEFT JOIN B_CMDB_MENU_LIST           TAB_B ON (TAB_A.MENU_ID       = TAB_B.MENU_ID)
    LEFT JOIN A_MENU_LIST                TAB_C ON (TAB_A.MENU_ID       = TAB_C.MENU_ID)
    LEFT JOIN A_MENU_GROUP_LIST          TAB_D ON (TAB_C.MENU_GROUP_ID = TAB_D.MENU_GROUP_ID)
  WHERE
     TAB_A.DISUSE_FLAG = '0' AND
     TAB_B.DISUSE_FLAG = '0' AND
     TAB_C.DISUSE_FLAG = '0' AND
     TAB_D.DISUSE_FLAG = '0';
  
  
  CREATE OR REPLACE VIEW D_CMDB_MENU_LIST_SHEET_TYPE_1 AS
  SELECT
   *
  FROM D_CMDB_MENU_LIST TAB_A
  WHERE (SHEET_TYPE IS NULL OR SHEET_TYPE = 1)
  ;
  
  CREATE OR REPLACE VIEW D_CMDB_MENU_LIST_SHEET_TYPE_1_JNL AS
  SELECT
   *
  FROM D_CMDB_MENU_LIST_JNL TAB_A
  WHERE (SHEET_TYPE IS NULL OR SHEET_TYPE = 1)
  ;
  
  CREATE OR REPLACE VIEW D_CMDB_MG_MU_COL_LIST_SHEET_TYPE_1 AS
  SELECT
   *
  FROM D_CMDB_MG_MU_COL_LIST TAB_A
  WHERE (SHEET_TYPE IS NULL OR SHEET_TYPE = 1)
  ;
  
  CREATE OR REPLACE VIEW D_CMDB_MG_MU_COL_LIST_SHEET_TYPE_1_JNL AS
  SELECT
   *
  FROM D_CMDB_MG_MU_COL_LIST_JNL TAB_A
  WHERE (SHEET_TYPE IS NULL OR SHEET_TYPE = 1)
  ;
  
  
  CREATE OR REPLACE VIEW D_CMDB_MENU_COLUMN_SHEET_TYPE_1 AS
  SELECT
    TAB_B.*,
    TAB_A.ACCESS_AUTH AS ACCESS_AUTH_01   ,
    TAB_A.ACCESS_AUTH_01 AS ACCESS_AUTH_02,
    TAB_A.ACCESS_AUTH_02 AS ACCESS_AUTH_03
  FROM
    D_CMDB_MENU_LIST_SHEET_TYPE_1         TAB_A
    LEFT JOIN B_CMDB_MENU_COLUMN TAB_B ON (TAB_A.MENU_ID = TAB_B.MENU_ID)
  WHERE
    TAB_B.COL_CLASS   <>  'FileUploadColumn' AND
    TAB_B.DISUSE_FLAG = '0'
  ;
  
  CREATE OR REPLACE VIEW D_CMDB_MENU_COLUMN_SHEET_TYPE_1_JNL AS
  SELECT
    TAB_B.*,
    TAB_A.ACCESS_AUTH AS ACCESS_AUTH_01   ,
    TAB_A.ACCESS_AUTH_01 AS ACCESS_AUTH_02,
    TAB_A.ACCESS_AUTH_02 AS ACCESS_AUTH_03
  FROM
    D_CMDB_MENU_LIST_SHEET_TYPE_1_JNL         TAB_A
    LEFT JOIN B_CMDB_MENU_COLUMN_JNL TAB_B ON (TAB_A.MENU_ID = TAB_B.MENU_ID)
  WHERE
    TAB_B.COL_CLASS   <>  'FileUploadColumn' AND
    TAB_B.DISUSE_FLAG = '0'
  ;
  
  CREATE OR REPLACE VIEW D_CMDB_MENU_COLUMN_SHEET_TYPE_1_PIONEER AS
  SELECT
    TAB_B.*,
    TAB_A.ACCESS_AUTH AS ACCESS_AUTH_01,
    TAB_A.ACCESS_AUTH_01 AS ACCESS_AUTH_02,
    TAB_A.ACCESS_AUTH_02 AS ACCESS_AUTH_03
  FROM
    D_CMDB_MENU_LIST_SHEET_TYPE_1         TAB_A
    LEFT JOIN B_CMDB_MENU_COLUMN TAB_B ON (TAB_A.MENU_ID = TAB_B.MENU_ID)
  WHERE
    TAB_B.COL_CLASS   <>  'MultiTextColumn' AND
    TAB_B.COL_CLASS   <>  'FileUploadColumn' AND
    TAB_B.DISUSE_FLAG = '0'
  ;
  
  CREATE OR REPLACE VIEW D_CMDB_MENU_COLUMN_SHEET_TYPE_1_PIONEER_JNL AS
  SELECT
    TAB_B.*,
    TAB_A.ACCESS_AUTH AS ACCESS_AUTH_01,
    TAB_A.ACCESS_AUTH_01 AS ACCESS_AUTH_02,
    TAB_A.ACCESS_AUTH_02 AS ACCESS_AUTH_03
  FROM
    D_CMDB_MENU_LIST_SHEET_TYPE_1_JNL         TAB_A
    LEFT JOIN B_CMDB_MENU_COLUMN_JNL TAB_B ON (TAB_A.MENU_ID = TAB_B.MENU_ID)
  WHERE
    TAB_B.COL_CLASS   <>  'MultiTextColumn' AND
    TAB_B.COL_CLASS   <>  'FileUploadColumn' AND
    TAB_B.DISUSE_FLAG = '0'
  ;
  
  CREATE OR REPLACE VIEW D_CMDB_MENU_LIST_SHEET_TYPE_1_PIONEER AS
  SELECT 
    TBL_A.*
  FROM 
    D_CMDB_MENU_LIST_SHEET_TYPE_1 TBL_A
  WHERE
    (SELECT 
       COUNT(*) 
     FROM 
       B_CMDB_MENU_COLUMN TBL_B
     WHERE
       TBL_A.MENU_ID     =   TBL_B.MENU_ID     AND
       TBL_B.COL_CLASS   <>  'MultiTextColumn' AND
       TBL_B.COL_CLASS   <>  'FileUploadColumn' AND
       TBL_B.DISUSE_FLAG =   '0'
    ) <> 0 
  ;
  
  CREATE OR REPLACE VIEW D_CMDB_MENU_LIST_SHEET_TYPE_1_PIONEER_JNL AS
  SELECT 
    TBL_A.*
  FROM 
    D_CMDB_MENU_LIST_SHEET_TYPE_1_JNL TBL_A
  WHERE
    (SELECT 
       COUNT(*) 
     FROM 
       B_CMDB_MENU_COLUMN_JNL TBL_B
     WHERE
       TBL_A.MENU_ID     =   TBL_B.MENU_ID     AND
       TBL_B.COL_CLASS   <>  'MultiTextColumn' AND
       TBL_B.COL_CLASS   <>  'FileUploadColumn' AND
       TBL_B.DISUSE_FLAG =   '0'
    ) <> 0
  ;
  
  CREATE OR REPLACE VIEW D_CMDB_MG_MU_COL_LIST_SHEET_TYPE_1_PIONEER AS
  SELECT
    TAB_A.COLUMN_LIST_ID                 ,
    CONCAT(TAB_D.MENU_GROUP_ID,':',TAB_D.MENU_GROUP_NAME,':',TAB_C.MENU_ID,':',TAB_C.MENU_NAME,':',TAB_A.COLUMN_LIST_ID,':',TAB_A.COL_TITLE) MENU_COL_TITLE_PULLDOWN,
    TAB_C.MENU_ID                        ,
    TAB_A.COL_TITLE_DISP_SEQ             ,
    TAB_B.ACCESS_AUTH                    ,
    TAB_A.DISP_SEQ                       ,
    TAB_A.NOTE                           ,
    TAB_A.DISUSE_FLAG                    ,
    TAB_A.LAST_UPDATE_TIMESTAMP          ,
    TAB_A.LAST_UPDATE_USER               ,
    TAB_A.ACCESS_AUTH AS ACCESS_AUTH_01  ,
    TAB_C.ACCESS_AUTH AS ACCESS_AUTH_02
  FROM        D_CMDB_MENU_COLUMN_SHEET_TYPE_1_PIONEER    TAB_A
    LEFT JOIN D_CMDB_MENU_LIST_SHEET_TYPE_1_PIONEER      TAB_B ON (TAB_A.MENU_ID       = TAB_B.MENU_ID)
    LEFT JOIN A_MENU_LIST                                TAB_C ON (TAB_A.MENU_ID       = TAB_C.MENU_ID)
    LEFT JOIN A_MENU_GROUP_LIST                          TAB_D ON (TAB_C.MENU_GROUP_ID = TAB_D.MENU_GROUP_ID)
  WHERE
     TAB_A.DISUSE_FLAG = '0' AND
     TAB_B.DISUSE_FLAG = '0' AND
     TAB_C.DISUSE_FLAG = '0' AND
     TAB_D.DISUSE_FLAG = '0'
  ;
  
  CREATE OR REPLACE VIEW D_CMDB_MG_MU_COL_LIST_SHEET_TYPE_1_PIONEER_JNL AS
  SELECT
    TAB_A.COLUMN_LIST_ID                 ,
    CONCAT(TAB_D.MENU_GROUP_ID,':',TAB_D.MENU_GROUP_NAME,':',TAB_C.MENU_ID,':',TAB_C.MENU_NAME,':',TAB_A.COLUMN_LIST_ID,':',TAB_A.COL_TITLE) MENU_COL_PULLDOWN,
    TAB_C.MENU_ID                        ,
    TAB_A.COL_TITLE_DISP_SEQ             ,
    TAB_B.ACCESS_AUTH                    ,
    TAB_A.DISP_SEQ                       ,
    TAB_A.NOTE                           ,
    TAB_A.DISUSE_FLAG                    ,
    TAB_A.LAST_UPDATE_TIMESTAMP          ,
    TAB_A.LAST_UPDATE_USER               ,
    TAB_A.ACCESS_AUTH AS ACCESS_AUTH_01  ,
    TAB_C.ACCESS_AUTH AS ACCESS_AUTH_02
  FROM        D_CMDB_MENU_COLUMN_SHEET_TYPE_1_PIONEER_JNL TAB_A
    LEFT JOIN D_CMDB_MENU_LIST_SHEET_TYPE_1_PIONEER       TAB_B ON (TAB_A.MENU_ID       = TAB_B.MENU_ID)
    LEFT JOIN A_MENU_LIST                                 TAB_C ON (TAB_A.MENU_ID       = TAB_C.MENU_ID)
    LEFT JOIN A_MENU_GROUP_LIST                           TAB_D ON (TAB_C.MENU_GROUP_ID = TAB_D.MENU_GROUP_ID)
  WHERE
     TAB_A.DISUSE_FLAG = '0' AND
     TAB_B.DISUSE_FLAG = '0' AND
     TAB_C.DISUSE_FLAG = '0' AND
     TAB_D.DISUSE_FLAG = '0'
  ;
  
  
  CREATE OR REPLACE VIEW D_CMDB_MENU_LIST_SHEET_TYPE_3 AS
  SELECT
   *
  FROM D_CMDB_MENU_LIST TAB_A
  WHERE SHEET_TYPE = 3
  ;
  
  CREATE OR REPLACE VIEW D_CMDB_MENU_LIST_SHEET_TYPE_3_JNL AS
  SELECT
   *
  FROM D_CMDB_MENU_LIST_JNL TAB_A
  WHERE SHEET_TYPE = 3
  ;
  
  CREATE OR REPLACE VIEW D_CMDB_MG_MU_COL_LIST_SHEET_TYPE_3 AS
  SELECT
   *
  FROM D_CMDB_MG_MU_COL_LIST TAB_A
  WHERE SHEET_TYPE = 3
  ;
  
  CREATE OR REPLACE VIEW D_CMDB_MG_MU_COL_LIST_SHEET_TYPE_3_JNL AS
  SELECT
   *
  FROM D_CMDB_MG_MU_COL_LIST_JNL TAB_A
  WHERE SHEET_TYPE = 3
  ;
  
  
  CREATE OR REPLACE VIEW D_CMDB_MENU_COLUMN_SHEET_TYPE_3 AS
  SELECT
    TAB_B.*,
    TAB_A.ACCESS_AUTH AS ACCESS_AUTH_01   ,
    TAB_A.ACCESS_AUTH_01 AS ACCESS_AUTH_02,
    TAB_A.ACCESS_AUTH_02 AS ACCESS_AUTH_03
  FROM
    D_CMDB_MENU_LIST_SHEET_TYPE_3         TAB_A
    LEFT JOIN B_CMDB_MENU_COLUMN TAB_B ON (TAB_A.MENU_ID = TAB_B.MENU_ID)
  WHERE
    TAB_B.COL_CLASS   <>  'FileUploadColumn' AND
    TAB_B.DISUSE_FLAG = '0'
  ;
  
  CREATE OR REPLACE VIEW D_CMDB_MENU_COLUMN_SHEET_TYPE_3_JNL AS
  SELECT
    TAB_B.*,
    TAB_A.ACCESS_AUTH AS ACCESS_AUTH_01   ,
    TAB_A.ACCESS_AUTH_01 AS ACCESS_AUTH_02,
    TAB_A.ACCESS_AUTH_02 AS ACCESS_AUTH_03
  FROM
    D_CMDB_MENU_LIST_SHEET_TYPE_3_JNL         TAB_A
    LEFT JOIN B_CMDB_MENU_COLUMN_JNL TAB_B ON (TAB_A.MENU_ID = TAB_B.MENU_ID)
  WHERE
    TAB_B.COL_CLASS   <>  'FileUploadColumn' AND
    TAB_B.DISUSE_FLAG = '0'
  ;
  
  
  INSERT INTO B_DP_MODE (ROW_ID,DP_MODE,NOTE,DISUSE_FLAG,LAST_UPDATE_TIMESTAMP,LAST_UPDATE_USER) VALUES(1,'上書き',NULL,'0',STR_TO_DATE('2015/04/01 10:00:00.000000','%Y/%m/%d %H:%i:%s.%f'),1);
  
  INSERT INTO B_DP_MODE (ROW_ID,DP_MODE,NOTE,DISUSE_FLAG,LAST_UPDATE_TIMESTAMP,LAST_UPDATE_USER) VALUES(2,'追記',NULL,'0',STR_TO_DATE('2015/04/01 10:00:00.000000','%Y/%m/%d %H:%i:%s.%f'),1);
  
  
  INSERT INTO B_DP_ABOLISHED_TYPE (ROW_ID,ABOLISHED_TYPE,NOTE,DISUSE_FLAG,LAST_UPDATE_TIMESTAMP,LAST_UPDATE_USER) VALUES(1,'廃止を含む',NULL,'0',STR_TO_DATE('2015/04/01 10:00:00.000000','%Y/%m/%d %H:%i:%s.%f'),1);
  
  INSERT INTO B_DP_ABOLISHED_TYPE (ROW_ID,ABOLISHED_TYPE,NOTE,DISUSE_FLAG,LAST_UPDATE_TIMESTAMP,LAST_UPDATE_USER) VALUES(2,'廃止を除く',NULL,'0',STR_TO_DATE('2015/04/01 10:00:00.000000','%Y/%m/%d %H:%i:%s.%f'),1);
  
  
  INSERT INTO F_PARAM_TARGET (TARGET_ID,DISP_SEQ,TARGET_NAME,NOTE,DISUSE_FLAG,LAST_UPDATE_TIMESTAMP,LAST_UPDATE_USER) VALUES(4,4,'パラメータシート（ファイルアップロードあり）',NULL,'0',STR_TO_DATE('2015/04/01 10:00:00.000000','%Y/%m/%d %H:%i:%s.%f'),1);
  INSERT INTO F_PARAM_TARGET_JNL (JOURNAL_SEQ_NO,JOURNAL_REG_DATETIME,JOURNAL_ACTION_CLASS,TARGET_ID,DISP_SEQ,TARGET_NAME,NOTE,DISUSE_FLAG,LAST_UPDATE_TIMESTAMP,LAST_UPDATE_USER) VALUES(4,STR_TO_DATE('2015/04/01 10:00:00.000000','%Y/%m/%d %H:%i:%s.%f'),'INSERT',4,4,'パラメータシート（ファイルアップロードあり）',NULL,'0',STR_TO_DATE('2015/04/01 10:00:00.000000','%Y/%m/%d %H:%i:%s.%f'),1);
  