EBS WebADI 存储过程增加参数

时间:2021-07-31 19:19:20

CREATE OR REPLACE FUNCTION CUX_EXEC_SQL (P_SQL IN VARCHAR2)
   RETURN NUMBER
AS
   L_CNT   NUMBER;
BEGIN
   EXECUTE IMMEDIATE P_SQL INTO L_CNT;

RETURN L_CNT;
EXCEPTION
   WHEN OTHERS
   THEN
      RETURN 0;
END;

--DROP TABLE CUX_TABLES_COUNTER;

CREATE TABLE CUX_TABLES_COUNTER AS
SELECT 'SELECT COUNT(*) FROM ' || OWNER || '.' || OBJECT_NAME STRING_CNT, -1 CNT1, -1 CNT2
FROM DBA_OBJECTS X
WHERE 1=1
AND X.OWNER = 'BNE'
AND X.OBJECT_TYPE = 'TABLE'
AND X.OBJECT_NAME LIKE 'BNE%'
;

UPDATE CUX_TABLES_COUNTER
SET CNT1 = CUX_EXEC_SQL(STRING_CNT);

UPDATE CUX_TABLES_COUNTER
SET CNT2 = CUX_EXEC_SQL(STRING_CNT);

SELECT *
FROM CUX_TABLES_COUNTER
where 1=1
and cnt1 <> cnt2;

--SELECT COUNT(*) FROM BNE.BNE_ATTRIBUTES
--SELECT COUNT(*) FROM BNE.BNE_CONTENTS_B
--SELECT COUNT(*) FROM BNE.BNE_CONTENTS_TL
--SELECT COUNT(*) FROM BNE.BNE_INTEGRATORS_B
--SELECT COUNT(*) FROM BNE.BNE_INTEGRATORS_TL
--SELECT COUNT(*) FROM BNE.BNE_INTERFACES_B
--SELECT COUNT(*) FROM BNE.BNE_INTERFACES_TL
--SELECT COUNT(*) FROM BNE.BNE_INTERFACE_COLS_B
--SELECT COUNT(*) FROM BNE.BNE_INTERFACE_COLS_TL
--SELECT COUNT(*) FROM BNE.BNE_LAYOUTS_B
--SELECT COUNT(*) FROM BNE.BNE_LAYOUTS_TL
--SELECT COUNT(*) FROM BNE.BNE_LAYOUT_BLOCKS_B
--SELECT COUNT(*) FROM BNE.BNE_LAYOUT_BLOCKS_TL
--SELECT COUNT(*) FROM BNE.BNE_LAYOUT_COLS
--SELECT COUNT(*) FROM BNE.BNE_PARAM_LISTS_B
--SELECT COUNT(*) FROM BNE.BNE_PARAM_LISTS_TL
--SELECT COUNT(*) FROM BNE.BNE_PARAM_LIST_ITEMS
--SELECT COUNT(*) FROM BNE.BNE_SECURED_OBJECTS
--SELECT COUNT(*) FROM BNE.BNE_SECURITY_RULES

--webadi过程接口,原来有18个传入参数,在定义webadi属性字段时增加了5个不属于过程中参数的自定义字段,目前需要向过程中增加两个参数
--CUX_JOB_IMPORT_PKG.IMPORT_JOB     INTERFACE_CODE LIKE CUXJIMP01

--将不属性过程参数的自定义字段向后推两个位置
UPDATE   BNE_INTERFACE_COLS_B
SET SEQUENCE_NUM =  SEQUENCE_NUM + 2,
DISPLAY_ORDER = DISPLAY_ORDER + 2
WHERE 1 = 1
AND SEQUENCE_NUM > 18
AND INTERFACE_CODE = 'CUXJIMP01_XINTG_INTF1'
;

--INSERT PARAMETERS TO TABLE BNE_INTERFACE_COLS_B
INSERT INTO BNE_INTERFACE_COLS_B
SELECT
APPLICATION_ID, INTERFACE_CODE, OBJECT_VERSION_NUMBER, 19 SEQUENCE_NUM, INTERFACE_COL_TYPE, 'P_ALTERNATE_BOM_DESIGNATOR' INTERFACE_COL_NAME, ENABLED_FLAG, REQUIRED_FLAG,  DISPLAY_FLAG, READ_ONLY_FLAG, NOT_NULL_FLAG, SUMMARY_FLAG, MAPPING_ENABLED_FLAG, DATA_TYPE, FIELD_SIZE, DEFAULT_TYPE, DEFAULT_VALUE, SEGMENT_NUMBER, GROUP_NAME, OA_FLEX_CODE, OA_CONCAT_FLEX, VAL_TYPE, VAL_ID_COL, VAL_MEAN_COL, VAL_DESC_COL, VAL_OBJ_NAME, VAL_ADDL_W_C, VAL_COMPONENT_APP_ID, VAL_COMPONENT_CODE, OA_FLEX_NUM, OA_FLEX_APPLICATION_ID, 19 DISPLAY_ORDER, 19 UPLOAD_PARAM_LIST_ITEM_NUM, EXPANDED_SQL_QUERY, CREATED_BY, CREATION_DATE, LAST_UPDATED_BY, LAST_UPDATE_LOGIN, LAST_UPDATE_DATE, LOV_TYPE, OFFLINE_LOV_ENABLED_FLAG, VARIABLE_DATA_TYPE_CLASS, VAL_QUERY_APP_ID, VAL_QUERY_CODE, EXPANDED_SQL_QUERY_APP_ID, EXPANDED_SQL_QUERY_CODE, VIEWER_GROUP, EDIT_TYPE, DISPLAY_WIDTH, ZD_EDITION_NAME
FROM BNE_INTERFACE_COLS_B
WHERE 1 = 1
AND INTERFACE_COL_NAME = 'P_COMMENTS'
AND INTERFACE_CODE = 'CUXJIMP01_XINTG_INTF1';

INSERT INTO BNE_INTERFACE_COLS_B
SELECT
APPLICATION_ID, INTERFACE_CODE, OBJECT_VERSION_NUMBER, 20 SEQUENCE_NUM, INTERFACE_COL_TYPE, 'P_ALTERNATE_ROUTING_DESIGNATOR' INTERFACE_COL_NAME, ENABLED_FLAG, REQUIRED_FLAG,  DISPLAY_FLAG, READ_ONLY_FLAG, NOT_NULL_FLAG, SUMMARY_FLAG, MAPPING_ENABLED_FLAG, DATA_TYPE, FIELD_SIZE, DEFAULT_TYPE, DEFAULT_VALUE, SEGMENT_NUMBER, GROUP_NAME, OA_FLEX_CODE, OA_CONCAT_FLEX, VAL_TYPE, VAL_ID_COL, VAL_MEAN_COL, VAL_DESC_COL, VAL_OBJ_NAME, VAL_ADDL_W_C, VAL_COMPONENT_APP_ID, VAL_COMPONENT_CODE, OA_FLEX_NUM, OA_FLEX_APPLICATION_ID, 20 DISPLAY_ORDER, 20 UPLOAD_PARAM_LIST_ITEM_NUM, EXPANDED_SQL_QUERY, CREATED_BY, CREATION_DATE, LAST_UPDATED_BY, LAST_UPDATE_LOGIN, LAST_UPDATE_DATE, LOV_TYPE, OFFLINE_LOV_ENABLED_FLAG, VARIABLE_DATA_TYPE_CLASS, VAL_QUERY_APP_ID, VAL_QUERY_CODE, EXPANDED_SQL_QUERY_APP_ID, EXPANDED_SQL_QUERY_CODE, VIEWER_GROUP, EDIT_TYPE, DISPLAY_WIDTH, ZD_EDITION_NAME
FROM BNE_INTERFACE_COLS_B
WHERE 1 = 1
AND INTERFACE_COL_NAME = 'P_COMMENTS'
AND INTERFACE_CODE = 'CUXJIMP01_XINTG_INTF1';

--将不属性过程参数的自定义字段向后推两个位置
UPDATE   BNE_INTERFACE_COLS_TL
SET SEQUENCE_NUM =  SEQUENCE_NUM + 2
WHERE 1 = 1
AND SEQUENCE_NUM > 18
AND INTERFACE_CODE = 'CUXJIMP01_XINTG_INTF1'
;

--INSERT PARAMETERS TO TABLE BNE_INTERFACE_COLS_TL
INSERT INTO BNE_INTERFACE_COLS_TL
SELECT
APPLICATION_ID, INTERFACE_CODE, 19 SEQUENCE_NUM, LANGUAGE, SOURCE_LANG, USER_HINT, 'ALTERNATE_BOM_DESIGNATOR' PROMPT_LEFT, USER_HELP_TEXT, '清单替代项' PROMPT_ABOVE, CREATED_BY, CREATION_DATE, LAST_UPDATED_BY, LAST_UPDATE_LOGIN, LAST_UPDATE_DATE, ZD_EDITION_NAME
FROM BNE_INTERFACE_COLS_TL
WHERE 1 = 1
AND PROMPT_LEFT = 'COMMENTS'
AND INTERFACE_CODE = 'CUXJIMP01_XINTG_INTF1'
;

INSERT INTO BNE_INTERFACE_COLS_TL
SELECT
APPLICATION_ID, INTERFACE_CODE, 20 SEQUENCE_NUM, LANGUAGE, SOURCE_LANG, USER_HINT, 'ALTERNATE_ROUTING_DESIGNATOR' PROMPT_LEFT, USER_HELP_TEXT, '工艺替代项' PROMPT_ABOVE, CREATED_BY, CREATION_DATE, LAST_UPDATED_BY, LAST_UPDATE_LOGIN, LAST_UPDATE_DATE, ZD_EDITION_NAME
FROM BNE_INTERFACE_COLS_TL
WHERE 1 = 1
AND PROMPT_LEFT = 'COMMENTS'
AND INTERFACE_CODE = 'CUXJIMP01_XINTG_INTF1'
;

--INSERT PARAMETERS TO TABLE BNE_ATTRIBUTES
INSERT INTO BNE_ATTRIBUTES
SELECT
APPLICATION_ID, 'CUXJIMP01_XINTG_UPL1_A19' ATTRIBUTE_CODE, OBJECT_VERSION_NUMBER, 'P_ALTERNATE_BOM_DESIGNATOR' ATTRIBUTE1, ATTRIBUTE2, ATTRIBUTE3, ATTRIBUTE4, ATTRIBUTE5, ATTRIBUTE6, ATTRIBUTE7, ATTRIBUTE8, ATTRIBUTE9, ATTRIBUTE10, ATTRIBUTE11, ATTRIBUTE12, ATTRIBUTE13, ATTRIBUTE14, ATTRIBUTE15, ATTRIBUTE16, ATTRIBUTE17, ATTRIBUTE18, ATTRIBUTE19, ATTRIBUTE20, ATTRIBUTE21, ATTRIBUTE22, ATTRIBUTE23, ATTRIBUTE24, ATTRIBUTE25, ATTRIBUTE26, ATTRIBUTE27, ATTRIBUTE28, ATTRIBUTE29, ATTRIBUTE30, CREATED_BY, CREATION_DATE, LAST_UPDATED_BY, LAST_UPDATE_DATE, LAST_UPDATE_LOGIN, ATTRIBUTE_NAME1, ATTRIBUTE_NAME2, ATTRIBUTE_NAME3, ATTRIBUTE_NAME4, ATTRIBUTE_NAME5, ATTRIBUTE_NAME6, ATTRIBUTE_NAME7, ATTRIBUTE_NAME8, ATTRIBUTE_NAME9, ATTRIBUTE_NAME10, ATTRIBUTE_NAME11, ATTRIBUTE_NAME12, ATTRIBUTE_NAME13, ATTRIBUTE_NAME14, ATTRIBUTE_NAME15, ATTRIBUTE_NAME16, ATTRIBUTE_NAME17, ATTRIBUTE_NAME18, ATTRIBUTE_NAME19, ATTRIBUTE_NAME20, ATTRIBUTE_NAME21, ATTRIBUTE_NAME22, ATTRIBUTE_NAME23, ATTRIBUTE_NAME24, ATTRIBUTE_NAME25, ATTRIBUTE_NAME26, ATTRIBUTE_NAME27, ATTRIBUTE_NAME28, ATTRIBUTE_NAME29, ATTRIBUTE_NAME30, ZD_EDITION_NAME
FROM BNE_ATTRIBUTES
WHERE 1 = 1
AND ATTRIBUTE1 = 'P_COMMENTS'
AND ATTRIBUTE_CODE LIKE 'CUXJIMP01_XINTG_UPL1_A%'
ORDER BY TO_NUMBER (REPLACE (ATTRIBUTE_CODE, 'CUXJIMP01_XINTG_UPL1_A', ''));

INSERT INTO BNE_ATTRIBUTES
SELECT
APPLICATION_ID, 'CUXJIMP01_XINTG_UPL1_A20' ATTRIBUTE_CODE, OBJECT_VERSION_NUMBER, 'P_ALTERNATE_ROUTING_DESIGNATOR' ATTRIBUTE1, ATTRIBUTE2, ATTRIBUTE3, ATTRIBUTE4, ATTRIBUTE5, ATTRIBUTE6, ATTRIBUTE7, ATTRIBUTE8, ATTRIBUTE9, ATTRIBUTE10, ATTRIBUTE11, ATTRIBUTE12, ATTRIBUTE13, ATTRIBUTE14, ATTRIBUTE15, ATTRIBUTE16, ATTRIBUTE17, ATTRIBUTE18, ATTRIBUTE19, ATTRIBUTE20, ATTRIBUTE21, ATTRIBUTE22, ATTRIBUTE23, ATTRIBUTE24, ATTRIBUTE25, ATTRIBUTE26, ATTRIBUTE27, ATTRIBUTE28, ATTRIBUTE29, ATTRIBUTE30, CREATED_BY, CREATION_DATE, LAST_UPDATED_BY, LAST_UPDATE_DATE, LAST_UPDATE_LOGIN, ATTRIBUTE_NAME1, ATTRIBUTE_NAME2, ATTRIBUTE_NAME3, ATTRIBUTE_NAME4, ATTRIBUTE_NAME5, ATTRIBUTE_NAME6, ATTRIBUTE_NAME7, ATTRIBUTE_NAME8, ATTRIBUTE_NAME9, ATTRIBUTE_NAME10, ATTRIBUTE_NAME11, ATTRIBUTE_NAME12, ATTRIBUTE_NAME13, ATTRIBUTE_NAME14, ATTRIBUTE_NAME15, ATTRIBUTE_NAME16, ATTRIBUTE_NAME17, ATTRIBUTE_NAME18, ATTRIBUTE_NAME19, ATTRIBUTE_NAME20, ATTRIBUTE_NAME21, ATTRIBUTE_NAME22, ATTRIBUTE_NAME23, ATTRIBUTE_NAME24, ATTRIBUTE_NAME25, ATTRIBUTE_NAME26, ATTRIBUTE_NAME27, ATTRIBUTE_NAME28, ATTRIBUTE_NAME29, ATTRIBUTE_NAME30, ZD_EDITION_NAME
FROM BNE_ATTRIBUTES
WHERE 1 = 1
AND ATTRIBUTE1 = 'P_COMMENTS'
AND ATTRIBUTE_CODE LIKE 'CUXJIMP01_XINTG_UPL1_A%'
ORDER BY TO_NUMBER (REPLACE (ATTRIBUTE_CODE, 'CUXJIMP01_XINTG_UPL1_A', ''));

--INSERT PARAMETERS TO TABLE BNE_PARAM_LIST_ITEMS
INSERT INTO BNE_PARAM_LIST_ITEMS
SELECT
APPLICATION_ID, PARAM_LIST_CODE, 19 SEQUENCE_NUM, OBJECT_VERSION_NUMBER, PARAM_DEFN_APP_ID, PARAM_DEFN_CODE, 'P_ALTERNATE_BOM_DESIGNATOR' PARAM_NAME, ATTRIBUTE_APP_ID, 'CUXJIMP01_XINTG_UPL1_A19' ATTRIBUTE_CODE, STRING_VALUE, DATE_VALUE, NUMBER_VALUE, BOOLEAN_VALUE_FLAG, FORMULA_VALUE, DESC_VALUE, CREATED_BY, CREATION_DATE, LAST_UPDATED_BY, LAST_UPDATE_DATE, LAST_UPDATE_LOGIN, ZD_EDITION_NAME
FROM BNE_PARAM_LIST_ITEMS
WHERE 1 = 1
AND PARAM_NAME = 'P_COMMENTS'
AND PARAM_LIST_CODE LIKE 'CUXJIMP01_XINTG_UPL1%';

INSERT INTO BNE_PARAM_LIST_ITEMS
SELECT
APPLICATION_ID, PARAM_LIST_CODE, 20 SEQUENCE_NUM, OBJECT_VERSION_NUMBER, PARAM_DEFN_APP_ID, PARAM_DEFN_CODE, 'P_ALTERNATE_ROUTING_DESIGNATOR' PARAM_NAME, ATTRIBUTE_APP_ID, 'CUXJIMP01_XINTG_UPL1_A20' ATTRIBUTE_CODE, STRING_VALUE, DATE_VALUE, NUMBER_VALUE, BOOLEAN_VALUE_FLAG, FORMULA_VALUE, DESC_VALUE, CREATED_BY, CREATION_DATE, LAST_UPDATED_BY, LAST_UPDATE_DATE, LAST_UPDATE_LOGIN, ZD_EDITION_NAME
FROM BNE_PARAM_LIST_ITEMS
WHERE 1 = 1
AND PARAM_NAME = 'P_COMMENTS'
AND PARAM_LIST_CODE LIKE 'CUXJIMP01_XINTG_UPL1%';

--INSERT PARAMETERS TO TABLE BNE_LAYOUT_COLS
INSERT INTO BNE_LAYOUT_COLS
SELECT
APPLICATION_ID, LAYOUT_CODE, BLOCK_ID, OBJECT_VERSION_NUMBER, INTERFACE_APP_ID, INTERFACE_CODE, 19 INTERFACE_SEQ_NUM, 190 SEQUENCE_NUM, STYLE, STYLE_CLASS, HINT_STYLE, HINT_STYLE_CLASS, PROMPT_STYLE, PROMPT_STYLE_CLASS, DEFAULT_TYPE, DEFAULT_VALUE, CREATED_BY, CREATION_DATE, LAST_UPDATED_BY, LAST_UPDATE_LOGIN, LAST_UPDATE_DATE, DISPLAY_WIDTH, READ_ONLY_FLAG, ZD_EDITION_NAME
FROM BNE_LAYOUT_COLS
WHERE 1 = 1
AND INTERFACE_SEQ_NUM = 18
AND INTERFACE_CODE = 'CUXJIMP01_XINTG_INTF1';

INSERT INTO BNE_LAYOUT_COLS
SELECT
APPLICATION_ID, LAYOUT_CODE, BLOCK_ID, OBJECT_VERSION_NUMBER, INTERFACE_APP_ID, INTERFACE_CODE, 20 INTERFACE_SEQ_NUM, 200 SEQUENCE_NUM, STYLE, STYLE_CLASS, HINT_STYLE, HINT_STYLE_CLASS, PROMPT_STYLE, PROMPT_STYLE_CLASS, DEFAULT_TYPE, DEFAULT_VALUE, CREATED_BY, CREATION_DATE, LAST_UPDATED_BY, LAST_UPDATE_LOGIN, LAST_UPDATE_DATE, DISPLAY_WIDTH, READ_ONLY_FLAG, ZD_EDITION_NAME
FROM BNE_LAYOUT_COLS
WHERE 1 = 1
AND INTERFACE_SEQ_NUM = 18
AND INTERFACE_CODE = 'CUXJIMP01_XINTG_INTF1';

--做完以上脚本处理,还是要动桌面集成管理器职责,到界面上更新一下集成器接口功能,并更一下布局,目的是将后台的数据和前台粘合初始化。

--alter session set nls_language='SIMPLIFIED CHINESE';
--alter session set nls_language='AMERICAN';
SELECT bni.application_id
     , bni.integrator_code                                                                                                                                                                     --集成器code
     , bni.user_name                                                                                                                                                                             --集成器名称
     , blv.layout_code                                                                                                                                                                            --布局代码
     , blv.user_name                                                                                                                                                                            --布局用户名称
     , blc.sequence_num
     , bic.*
  FROM bne_integrators_vl bni
     , bne_layouts_vl blv
     , bne_layout_cols blc
     , bne_interface_cols_vl bic
WHERE bni.user_name LIKE 'CUXJIMP01%'
       AND blv.integrator_app_id = bni.application_id
       AND blv.integrator_code = bni.integrator_code
       AND blv.layout_code = blc.layout_code
       AND blc.interface_app_id = bic.application_id
       AND blc.interface_code = bic.interface_code
       AND blc.interface_seq_num = bic.sequence_num;