I am using SQLLoader for connecting with a delimited file.
I want to mark the account as disabled if an attribute isActive is TRUE.
For that, i used this query, but everytime it’s returning IIQDisabled true:
select UserName, Name, CreatedDate, LastLogon, Module, isActive, IF(isActive =‘FALSE’, ‘true’, ‘false’) as IIQDisabled from acme_test ORDER BY UserName ASC.
I even tried this query:
select UserName, Name, CreatedDate, LastLogon, Module, isActive,
CASE
WHEN isActive='TRUE' || isActive='True' THEN 'false'
ELSE 'true'
END AS IIQDisabled from acme_test ORDER BY UserName ASC
It gave the same result. IIQDisabled is always set to true.
check the type of isActive, if is a boolean try this:
select UserName,
Name,
CreatedDate,
LastLogon,
Module,
isActive,
case
when isActive = 0 // or isActive = '0'
then 'True'
else 'False'
end as IIQDisabled
from acme_test
ORDER BY UserName ASC
alse, if it is a string
select UserName,
Name,
CreatedDate,
LastLogon,
Module,
isActive,
case
when lower(isActive) = 'false'
then 'True'
else 'False'
end as IIQDisabled
from acme_test
ORDER BY UserName ASC
I agree with Emanuele Nistri. Knowing what type of field “IsActive” actually is the key to ensuring this works as expected. In addition to this providing a sample of the actual data from this SELECT would also be helpful along include “IsActive” as a field in the query to see what values it has in comparison to the calculated value.