Review the actual resulting SQL string after variable insertion. In the example WHERE clause, we see a quoted value — CUSN=’3559′. Those quotes are necessary for SQL to interpret the characters as a character literal value.
You might debug the script to look at the full SELECT statement just before it is passed for execution. The variable value should show in the statement, surrounded by quotes for a character column and not surrounded by quotes for a numeric column.
Getting the quotes right is one of the tricky parts of creating SQL statements for a server.