Quantcast
Channel: IBM Mainframe Computers Forums
Viewing all articles
Browse latest Browse all 8500

DB2 :: RE: Need help on SQL Dynamic WHERE Clause

$
0
0
Author: subratarec
Posted: Mon Jul 18, 2016 3:49 pm (GMT 5.5)

Hi Pandora,

For time being I am using below..

Code:
WHERE (:WS-POLICY-START-DATE > 0    AND
             :WS-POLICY-END-DATE > 0       AND
             :WS-POLICY-HOLDER-NAME > 0 AND
             ;   
             ;   <OTHER WORKING STORAGE VARIABLES>
             ;
             POLICY_START_DATE = :WS-POLICY-START-DATE  AND
             POLICY_END_DATE  = :WS-POLICY-END-DATE AND
             POLICY_HOLDER_NAME = :WS-POLICY-HOLDER-NAME AND
             ;
             ;   <OTHER  VARIABLES >
             ;)
                                OR
             (:WS-POLICY-START-DATE > 0  AND
               POLICY_START_DATE = :WS-POLICY-START-DATE )
                                OR
             (:WS-POLICY-END-DATE > 0 AND
               POLICY_END_DATE  = :WS-POLICY-END-DATE)
                                OR
             REMAINING CODES....

Here I am trying to check if all the field variables are filled by user then do something and then I am issuing OR for if user fill only a particular field or combinations of fields..

I know this may not be the correct approach but if for time being I am continuing my coding and testing screens like this..

Thanks


Viewing all articles
Browse latest Browse all 8500

Trending Articles