Jeg tror, du forsøger at bortfiltrere værdier såsom 07-AUG-15
men dit like-mønster siger 07_%
. Det burde være
gal.name not like '07-%'
Desuden giver din sidste del som påpeget nedenfor ingen mening; snarere bør du inkludere disse betingelser i hovedforespørgslen WHERE
klausul.
and ( exists (select FIRSTNAME
from TCPD_PERSONEL_COPY
where (gal.name not like '07_%' AND
gal.name not like 'TR_%' AND
gal.name not like 'ST_%' AND
gal.name not like 'KB_%' AND
gal.name not like 'HS_%' AND
gal.name is not null))
Din SELECT
skal se ud
SELECT SUBSTR(NAME, 1, 50),SUBSTR( GIVEN_NAME, 1, 50), DEPARTMENT, PHONE, SUBSTR(MAIL, 1, 100), SUBSTR(LOGIN, 1, 255), SYSDATE
FROM gal
WHERE ( NOT EXISTS (SELECT EMAIL1
FROM TCPD_PERSONEL_COPY
WHERE GAL.mail = TCPD_PERSONEL_COPY.email1)
OR NOT EXISTS (SELECT userid
FROM TCPD_PERSONEL_COPY
WHERE gAL.LOGIN = TCPD_PERSONEL_COPY.userid))
AND GAL.mail IS NOT NULL AND GAL.COUNTRY='GERMANY'
AND ( gal.name not like '07_%' OR
gal.name not like 'TR_%' OR
gal.name not like 'ST_%' OR
gal.name not like 'KB_%' OR
gal.name not like 'HS_%' OR
gal.name is not null);