I have to write a SQL having where condition as given below:
Where Column_1 IN(:host_variable)
the host_variable is defined as
05 host_variable.
10 host_1 PIC X(02).
10 host_2 PIC X(02).
10 host_3 PIC X(02).
10 host_4 PIC X(02).
10 host_5 PIC X(02).
10 host_1 PIC X(02).
10 host_2 PIC X(02).
10 host_3 PIC X(02).
10 host_4 PIC X(02).
10 host_5 PIC X(02).
Column_1 can have values IC, NV, MF, MS, GP, SPACES for Column_2 = 'A'
Column_1 can have values BN, SPACES Column_2 = 'B'
We don't want to fetch rows having Column_1 as SPACES.
Now, the issue is arising when I am trying to fetch values for Column_2 = 'B'
The value in host_variable is being passed as 'BN' which is as expected, however SPACES are also being passed here.. and while fetching the rows.. it is also fetching the rows having value Column_1 as SPACES
When I reduced the size of host_variable to 2 char only, it is working fine, however, for Column_2 = 'A', it should be 10 char. I have one more issue that I have to keep the host_variable as 10 char.
Please suggest on this..how I can avoid the rows for which Column_1 is SPACES