Você está na página 1de 3

set set set set set

echo off verify off lines 2000 verify off pages 2000

SPOOL C:\TET#29186\output.csv SELECT TO_CHAR(SYSDATE,'DD/MM/YYYY HH24:MI:SS') FROM DUAL; /* Bad SELECT FROM WHERE GROUP Records */ 'Exceptions' type,if_row_stat,if_row_batch_num,COUNT(*) siebel.EIM_CONTACT if_row_batch_num = 20094805 BY if_row_stat,if_row_batch_num;

/* Remove Account Contact Associations*/ SELECT 'Remove Account Assoc' type,if_row_stat,if_row_batch_num,COUNT(*) FROM siebel.EIM_CONTACT WHERE if_row_batch_num between 20094850 and 20094853 GROUP BY if_row_stat,if_row_batch_num; /* Remove Contact Funcitons*/ SELECT 'Remove Contact Funcs' TYPE,IF_ROW_STAT,IF_ROW_BATCH_NUM,COUNT(*) FROM siebel.EIM_CONTACT3 WHERE if_row_batch_num between 20094865 and 20094885 GROUP BY if_row_stat,if_row_batch_num; /* Add SELECT FROM WHERE GROUP Contact Records */ 'Insert Contact' type,if_row_stat,if_row_batch_num,COUNT(*) siebel.EIM_CONTACT if_row_batch_num between 20094820 and 20094823 BY if_row_stat,if_row_batch_num;

/* Update Contact and assoc Records */ SELECT 'update Contacts and assoc' type,if_row_stat,if_row_batch_num,COUNT(*) FROM siebel.EIM_CONTACT WHERE if_row_batch_num between 20094810 and 20094813 GROUP BY if_row_stat,if_row_batch_num; /* Update Contact Records */ SELECT 'update Contacts' type,if_row_stat,if_row_batch_num,COUNT(*) FROM siebel.EIM_CONTACT WHERE if_row_batch_num between 20094815 and 20094818 GROUP BY if_row_stat,if_row_batch_num; /* Insert for New Contact Funcionts */ SELECT 'Insert Contact Funcs' TYPE,IF_ROW_STAT,IF_ROW_BATCH_NUM,COUNT(*) FROM siebel.EIM_CONTACT3 WHERE if_row_batch_num between 20094820 and 20094860 GROUP BY if_row_stat,if_row_batch_num; /* Insert User Id */ SELECT 'Insert User Id' TYPE,IF_ROW_STAT,IF_ROW_BATCH_NUM,COUNT(*) FROM SIEBEL.EIM_CONTACT_XM WHERE IF_ROW_BATCH_NUM BETWEEN 20094820 AND 20094828 GROUP BY if_row_stat,if_row_batch_num;

/* Remove User Id */ SELECT 'Insert User Id' TYPE,IF_ROW_STAT,IF_ROW_BATCH_NUM,COUNT(*) FROM SIEBEL.EIM_CONTACT_XM WHERE IF_ROW_BATCH_NUM BETWEEN 20094830 AND 20094833 GROUP BY if_row_stat,if_row_batch_num; SELECT TO_CHAR(SYSDATE,'DD/MM/YYYY HH24:MI:SS') FROM DUAL; SPOOL OFF; SET echo OFF SET Termout OFF SET feedback OFF SET linesize 2500 SET pagesize 0 SET newpage 0 SET SPACE 0 SET trimspool ON SET HEADING OFF SET wrap OFF SET underline OFF spool C:\TET#29186\Failed_records.csv select 'AccountNum,Action,Function1,Function2,Function3,Function4,Title,c-num,FstName,L astName,Email, Phone,Status,AccFunction,UserIdType, User Id, Title,FailureReason ' from dual UNION ALL SELECT x_sfdc_id ||','|| t_deleted_row_id||','|| TIMEZONE_NAME||','|| REL_PERSON_UID||','|| REL_CON_BU||','|| X_COMPETITOR_NAME||','|| CON_PER_TITLE||','|| x_con_uniq_num||','|| con_fst_name||','|| con_last_name||','|| CON_EMAIL_ADDR||','|| CON_WORK_PH_NUM||','|| X_STATUS||','|| X_CURRENCY||','|| X_LOCAL_FST_NAME||','|| X_LOCAL_MID_NAME||','|| CON_JOB_TITLE||','|| IF_ROW_STAT FROM siebel.EIM_CONTACT WHERE if_row_batch_num = 20094805; spool off; spool C:\TET#29186\New_Contacts.csv select 'AccountNum,Action,Function1,Function2,Function3,Function4,Con_rowId,C-num,Title ,FstName,LastName,Email, Phone,Status,AccFunction,UserIdType, User Id, Title' fr om dual UNION ALL SELECT distinct

e.x_sfdc_id ||','|| e.t_deleted_row_id||','|| e.TIMEZONE_NAME||','|| e.REL_PERSON_UID||','|| e.REL_CON_BU||','|| e.X_COMPETITOR_NAME||','|| e.t_contact__rid||','|| c.x_con_uniq_num||','|| e.CON_PER_TITLE||','|| e.con_fst_name||','|| e.con_last_name||','|| e.CON_EMAIL_ADDR||','|| e.CON_WORK_PH_NUM||','|| e.X_STATUS||','|| e.X_CURRENCY||','|| e.X_LOCAL_FST_NAME||','|| e.X_LOCAL_MID_NAME||','|| e.CON_JOB_TITLE FROM siebel.EIM_CONTACT e, siebel.s_contact c WHERE if_row_batch_num between 20094820 and 20094823 and e.t_contact__rid=c.row_id; spool off; EXIT

Você também pode gostar