0

I am using Oracle 9i as my database. My problem is the columns of the this database supplies an ample amount of white spaces.
For Example:
Username with Char(100) if I insert a 5 character inside this column like ADMIN it will have 95 white space after the word ADMIN.

The problem now is that every time I query I needed to use TRIM inside my query or else it will not work.

For example : SELECT COUNT(USERNAME) AS TOTAL FROM ASUSERACCOUNT WHERE TRIM(USERNAME) = :username

Are there any configurations I need to make to remove whitespaces on my database?

Maricris
  • 97
  • 2
  • 8
  • How are you inserting the data? – bassxzero Nov 06 '20 at 01:04
  • @bassxzero just a normal way of inserting without white spaces. The problem with the oracle database is that it automatically adds the white space – Maricris Nov 06 '20 at 01:05
  • I could be wrong, but I don't think oracle databases support any type of columns that automatically add whitespace to your data. Which is why I'm asking how you're inserting the data. Maybe there is a function/trigger running that is updating your data. – bassxzero Nov 06 '20 at 01:07
  • @bassxzero based on my experience with other database only in Oracle 9i I have experience this. When you access the data inside the database you can see that there is a white space automatically added – Maricris Nov 06 '20 at 01:14
  • How is the column defined? – Dave Nov 06 '20 at 01:16
  • Why not use `VARCHAR2`? ~ https://asktom.oracle.com/pls/apex/f?p=100:11:::::P11_QUESTION_ID:123212348063,# – Phil Nov 06 '20 at 01:22

0 Answers0