The SQLCODE is being returned by the RDBMS to your REXX EXEC. You might tell us what OS and what RDBMS you are using.
in DB2 for z/OS the SQLCODE -104 means an ILLEGAL SYMBOL – using DSNTIAR (or looking at the SQLCA) you can get the value that DB2 thinks is illegal.
You are a passing a char value… I assume this is used in the where clause. How are you passing it? As a parm? You might check the query AFTER you “pass a char value” to see exactly what the query looks like just before execution. things like the quote marks can throw one way off.
If you are using a different RDBMS or a different OS, please disregard my comments.