I have frequently used the trim command for one purpose or another, but I have not used it to extract a literal out of a field, which I recently used to extract invalid values from a field in SQL. So, I am providing a sample SQL for Future reference.
Select trim (‘I’ FROM <<FieldName>>) AS <<FieldName>>
In this example an invalid indicator (‘Y’) is being removed, performing a Null Value Logic (NVL) substitution to an integer compatible value, then the field is converted to an integer.
CAST( NVL(trim (‘Y’ FROM AA.Status_ID) ,’0′)AS INT) AS PACK_SZ
From Inventory_code_TBL AA;