SQL: Updating Name without special characters.
%Execute()
UPDATE %Table(LAC_AB540_STG) B
SET B.FIRST_NAME = (
SELECT TRANSLATE(A.FIRST_NAME
,'éêëèÉÈÊËðÐâàáãæàåÅÀÁÂÃÆäÄïîìíÌÍÎÏôòóõøÒÓÔÕØöÖûùúÙÚÛÜüñÑÇçýÿÝþÞ'
,'eeeeEEEEDDaaaaaaaAAAAAAaAiiiiIIIIoooooOOOOOoOuuuUUUUunNCcyyYTt')
FROM PS_LAC_NAMES A
WHERE A.EMPLID = B.EMPLID
AND A.NAME_TYPE = 'PRI'
AND A.EFF_STATUS = 'A'
AND A.EFFDT = (
SELECT MAX(A_ED.EFFDT)
FROM PS_LAC_NAMES A_ED
WHERE A.EMPLID = A_ED.EMPLID
AND A.NAME_TYPE = A_ED.NAME_TYPE
AND A_ED.EFFDT <=%CurrentDateIn ))
WHERE B.PROCESS_INSTANCE = %ProcessInstance
AND EXISTS (
SELECT 1
FROM PS_LAC_NAMES A
WHERE A.EMPLID = B.EMPLID
AND A.NAME_TYPE = 'PRI'
AND A.EFF_STATUS = 'A'
AND A.EFFDT = (
SELECT MAX(A_ED.EFFDT)
FROM PS_LAC_NAMES A_ED
WHERE A.EMPLID = A_ED.EMPLID
AND A.NAME_TYPE = A_ED.NAME_TYPE
AND A_ED.EFFDT <=%CurrentDateIn ));
UPDATE %Table(LAC_AB540_STG) B
SET B.FIRST_NAME = (
SELECT TRANSLATE(A.FIRST_NAME
,'éêëèÉÈÊËðÐâàáãæàåÅÀÁÂÃÆäÄïîìíÌÍÎÏôòóõøÒÓÔÕØöÖûùúÙÚÛÜüñÑÇçýÿÝþÞ'
,'eeeeEEEEDDaaaaaaaAAAAAAaAiiiiIIIIoooooOOOOOoOuuuUUUUunNCcyyYTt')
FROM PS_LAC_NAMES A
WHERE A.EMPLID = B.EMPLID
AND A.NAME_TYPE = 'PRI'
AND A.EFF_STATUS = 'A'
AND A.EFFDT = (
SELECT MAX(A_ED.EFFDT)
FROM PS_LAC_NAMES A_ED
WHERE A.EMPLID = A_ED.EMPLID
AND A.NAME_TYPE = A_ED.NAME_TYPE
AND A_ED.EFFDT <=%CurrentDateIn ))
WHERE B.PROCESS_INSTANCE = %ProcessInstance
AND EXISTS (
SELECT 1
FROM PS_LAC_NAMES A
WHERE A.EMPLID = B.EMPLID
AND A.NAME_TYPE = 'PRI'
AND A.EFF_STATUS = 'A'
AND A.EFFDT = (
SELECT MAX(A_ED.EFFDT)
FROM PS_LAC_NAMES A_ED
WHERE A.EMPLID = A_ED.EMPLID
AND A.NAME_TYPE = A_ED.NAME_TYPE
AND A_ED.EFFDT <=%CurrentDateIn ));
Comments
Post a Comment