EVEN BETTER!!
My last message was a solution, but not the best one...
When I tried to set the data type for the bind_param method, I used 12, which is VARCHAR2, but I should have checked more carefully. The data type in the database is CHAR (type #1). I suspected the data type from the start, but I didn't know how to set the data type properly at first. I thought the data type was VARCHAR2 anyway, which the documentation says is the default.
Instead of using the trim SQL function, it works if I set the data type in the bind_param method to 1, i.e.:
$sth->bind_param( 1, $_, 1 )
:)
GM