Hi, I have two tables TableA ( INV_NBR varchar (15) ) and TableB ( INV_NBR varchar (15) ). In both the tables, TableA and TableB the INV_NBR has values '14-2/324', when I join the two tables based on INV_NBR it shows "0" records.
Used below query: Select * from TableA A inner join TableB B ON A.INV_NBR =B.INV_NBR
---Result 0 records.
I tried using cast and trim but same result.
Can someone please help me with this issue.
Thanks in Advance.
and pleas show us the result of
select 'xxx' || INV_NBR || 'yyy' from TableA where INV_NBR = '14-2/324';
select 'xxx' || INV_NBR || 'yyy' from TableB where INV_NBR = '14-2/324';
Here is the DDL of two tables followed by result to the query set,
In this case your query is giving the correct result.
You need to check why tableB does not contain the value '14-2/324'...
Got it finally, TabelB is loaded form file and the file has a tab character at the end. So the value of INV_NBR was inserted with trailing tab.
The TRIM function only removes spaces and not the tab, so there was not match resulted.
After reloding the file it worked.
Thanks the query helped.