I used the following statement below:
Trim(IF FromDataSource.PID_VALID = 'Y' THEN FromDataSource.Person_ID ELSE @NULL)
I used the following statement below:
Trim(IF FromDataSource.PID_VALID = 'Y' THEN FromDataSource.Person_ID ELSE @NULL)
Assuming you are using this code within a Transformer stage in DataStage this will help
IF Trim(FromDataSource.PID_VALID) = 'Y' THEN Trim(FromDataSource.Person_ID) ELSE @NULL
Hint: For you next question you might ask in this forum you should provide more details - do not let us guess. Also describe what you have tried and what error you got etc.
You can use case
expression :
(CASE WHEN FromDataSource.PID_VALID = 'Y' THEN TRIM(FromDataSource.Person_ID) END)
else
will return null
if condition evaluate as false, you don't need to specify null
.
If you want to set null if PID is not valid then->
IF FromDataSource.PID_VALID = 'Y' THEN trim(FromDataSource.Person_ID) ELSE setnull()
If you want to set empty when PID is not valid then->
IF FromDataSource.PID_VALID = 'Y' THEN trim(FromDataSource.Person_ID) ELSE ''