SQL Question - Varchar and Char type join

Hi all.  I am attempting to perform a join in a SQL statement of varchar and char on 2 different tables based in an Oracle DB.  The field name is "Serl_Nbr" in both tables.  Granted, I'd like to correct the issue in the DB, but this is somewhat of a lost cause as I am not the DBA and do not feel comfortable generating such a change on a whim.  Thanks in advance.
smagnus1Asked:
Who is Participating?
I wear a lot of hats...

"The solutions and answers provided on Experts Exchange have been extremely helpful to me over the last few years. I wear a lot of hats - Developer, Database Administrator, Help Desk, etc., so I know a lot of things but not a lot about one thing. Experts Exchange gives me answers from people who do know a lot about one thing, in a easy to use platform." -Todd S.

Nick UpsonPrincipal Operations EngineerCommented:
select ....
from tablea a
join tableb b on trim(a.Serl_Nbr) = trim(b.Serl_Nbr)
where ...
0

Experts Exchange Solution brought to you by

Your issues matter to us.

Facing a tech roadblock? Get the help and guidance you need from experienced professionals who care. Ask your question anytime, anywhere, with no hassle.

Start your 7-day free trial
Jinesh KamdarCommented:
SELECT A.col, B.col FROM table1 A, table2 B WHERE TRIM(a.serl_nbr) = TRIM(b.serl_nbr);

>> I am not the DBA and do not feel comfortable generating such a change on a whim.

You need *NOT* be a DBA to make such decisions as defining a NUMERIC PK id for ur tables. If the table-design is in ur hands, then u can definitely enforce to change its structure to a more realistic design and ur DBA will be more than happy to do it for u since he realises that doing it will ultimately increase the peformance and reduce his head-ache too.
0
David ToddSenior DBACommented:
Hi,

Depending on the dialect of SQL that you are using, the function you are looking for code be rtrim( ).

Cheers
  David
0
smagnus1Author Commented:
I truely do wish I could convince the powers that be to change this field type, but it is a "one man versus the world" type thing.  This did work, although my query is not really any faster.  I am thinking maybe a subquery, but I haven't pulled this off as of yet.  Thanks for your help.
0
It's more than this solution.Get answers and train to solve all your tech problems - anytime, anywhere.Try it for free Edge Out The Competitionfor your dream job with proven skills and certifications.Get started today Stand Outas the employee with proven skills.Start learning today for free Move Your Career Forwardwith certification training in the latest technologies.Start your trial today
Databases

From novice to tech pro — start learning today.