Skip to Main Content
  • Questions
  • setting that trim the leading and trailing spaces in oracle

Breadcrumb

Question and Answer

Connor McDonald

Thanks for the question.

Asked: September 27, 2016 - 2:37 pm UTC

Last updated: September 28, 2016 - 4:11 am UTC

Version: oracle 12c

Viewed 1000+ times

You Asked

We are migrating from Db2 to oracle and in Db2 when you insert/update any value, Db2 automatically trim leading and trailing spaces. I want to know if we have any setting on column or table level in oracle that will automatically trim the values. I dont want to modify my query to use trim function.

Please suggest

and Connor said...

I havent used DB2 for a long time, but when I did, I'm pretty sure the *database* didnt automatically trim spaces from either front or end of fields.

If you inserted a string "HELLO..." (dots = spaces), then those spaces would be preserved. A quick google suggests this is still the case, because there are lots of posts about how to *remove* or *ignore* the spaces that have been stored in the (DB2) database.

Are you sure it is not a *tool* sitting in front of the database that is doing this ?

But to answer your question - I do not know of any automatic way that this occurs in Oracle.

Rating

  (1 rating)

Is this answer out of date? If it is, please let us know via a Comment

Comments

A reader, September 28, 2016 - 4:51 am UTC