Error in the AqlDecode Function

Hi ,


We  have recently migrated from ac5.11 to ac9.40  , We have a number of queries which used AqlDecode function and worked correctly in 5.11 but not in ac9.40 , for eg: 


I have this query on amPOrder table :


AqlDecode($PoNumberLike, '', ' ', upper(PONumber)) LIKE AqlDecode($PoNumberLike, '', ' ', upper($PoNumberLike))


which works well when i filter on anything like %2% , %1% etc but whenever i use %3% or anything starting with %3 

I get the below mentioned error:




Thanks in advance ,