SET PAGESIZE 0
SET FEEDBACK OFF
SET LINESIZE 2000
SET HEADING OFF
SET TRIMSPOOL ON
SET ECHO OFF
SET TERMOUT OFF
SPOOL /tmp/kaka_menu_data.sql
SELECT 'MERGE INTO CONTINEW_ZHICHAO.SYS_MENU t USING (SELECT ' || ID || ' AS ID FROM DUAL) s ON (t.ID = s.ID) WHEN NOT MATCHED THEN INSERT (ID,TITLE,PARENT_ID,TYPE,IS_EXTERNAL,IS_CACHE,IS_HIDDEN,SORT,STATUS,CREATE_USER) VALUES (' || ID || ', ''' || REPLACE(TITLE,'''','''''') || ''', ' || PARENT_ID || ', ' || TYPE || ', ' || NVL(IS_EXTERNAL,0) || ', ' || NVL(IS_CACHE,0) || ', ' || NVL(IS_HIDDEN,0) || ', ' || NVL(SORT,999) || ', ' || NVL(STATUS,1) || ', 1);' FROM CONTINEW_ZHICHAO.SYS_MENU;
SELECT 'MERGE INTO CONTINEW_ZHICHAO.SYS_ROLE_MENU t USING (SELECT ' || ROLE_ID || ' AS ROLE_ID, ' || MENU_ID || ' AS MENU_ID FROM DUAL) s ON (t.ROLE_ID = s.ROLE_ID AND t.MENU_ID = s.MENU_ID) WHEN NOT MATCHED THEN INSERT (ROLE_ID, MENU_ID) VALUES (' || ROLE_ID || ', ' || MENU_ID || ');' FROM CONTINEW_ZHICHAO.SYS_ROLE_MENU;
SPOOL OFF
EXIT
