Reputation: 1
I am using OCI8 for PHP for connecting to an Oracle 11g database.
Everything is working fine, but the imported values from Oracle database come with spaces, completed to full lenght.
For example, the value on DB is with NCHAR(10 CHAR)
'value'
OCI8 returns
'value '
with 5 spaces, 10 chars total.
Any ideas or recommendations?
Upvotes: 0
Views: 61
Reputation: 14762
Yes, all *char types in Oracle have spaces appended all the way to the end, this is not PHP-specific. Use RTRIM()
if you don't want them:
SELECT RTRIM(field_name) AS field_name ...
... or PHP's own rtrim()
of course.
Upvotes: 1