Issue with bind variable format in Automation


I’ve recently run into a problem getting a bind variable to work in a query when it is in Automation. The query in format is:

select item1,
from table
where id = input(:counter,8.)

when I run the query in the editor, I can type in an appropriate value (like 1234) in the prompt and the query runs successfully. I don’t make any changes to the other settings in the prompt (type = 0, direction = IN). When I put the query in an automation after a set variable activity to set the value as 1234, I get an error that the input function requires a character argument. If I add an additional set variable activity at the beginning and set the value to string, in an attempt to set the variable format as string characters, I get the error Unable to cast object of type ‘System.Int16’ to type ‘System.String’.

Is there any way to set a bind variable that contains only numeric characters to a string format?