mardi 19 mars 2019

PL/SQL if statement incorrect validation

In my PL/SQL script, i have the following code :

    BEGIN    
         SELECT *
         INTO GENERIC_DETAIL_rec
         FROM GENERIC_DETAIL
         WHERE PARAMETER_TYPE = 'IDDOC'
         AND TRIM(GENERIC_DETAIL.SHORT_DESCRIPTION) = TRIM(I.MOF_IDDOC_TYPE)
         AND GENERIC_DETAIL.ENTRY_STATUS = '1';
    EXCEPTION
         WHEN NO_DATA_FOUND THEN
             DBMS_OUTPUT.put_line('NO DATA!!');
    END;
 IF (GENERIC_DETAIL_rec.SHORT_DESCRIPTION IS NULL ) OR (I.MOF_IDDOC_TYPE IS NULL) THEN 
         UPDATE MOF_INACCREG_REQ 
         SET PRFT_RESULT_CODE = '60'
         WHERE MOF_INACCREG_REQ.MOF_REQUEST_ID = I.MOF_REQUEST_ID;
 ELSE --do something else

All i want to do is to investigate if the field I.MOF_IDDOC_TYPE is blank or its value does not match any of the values of GENERIC_DETAIL.SHORT_DESCRIPTION.

The second condition for the blank field works fine, so it does commit the update below.

My problem is the first condition.If the value of I.MOF_IDDOC_TYPE is not contained in GENERIC_DETAIL.SHORT_DESCRIPTION, the condition is false and it does not commit the update.

Any idea? Thanks in advance.

Aucun commentaire:

Enregistrer un commentaire