995017 wrote:That first thing you need to make sure is that, does branch_code contain any character value. If the answer is NO then you can just use TO_NUMBER function and convert the column.
I have 2 tables. and i want to get the branch name from table2..but the thing is
i have 2 different data type to link or join the two tables.
- branch_id (number) ex. 1,2,3..
-branch_code (varchar2) ex. 001, 002, 003...
But if the answer is YES then you cant join BRANCH_ID and BRANCH_CODE.
where branch_id = to_number(branch_code)
995017 wrote:Well, you may do a join for the rows that are convertable to number
unfortunately. branch code from table 2 has a character value :(.
You may also go a step further and clean up the"dirty" branch_codes. For help on this, you should give some examples of the non-valid data.
select branch_id ,branch_code from tbl1, (select branch_code from tbl2 where -- this is valid for positiv integers translate ( branch_code , 'a1234567890', 'a') is null ) tbl2 where branch_id = to_number( branch_code )
995017 wrote:Your welcome.
chris227 for your suggestion!!
Edited by: 995017 on Mar 20, 2013 9:22 PM