lemmin Posted July 31, 2008 Share Posted July 31, 2008 I have the following two tables: funding(FundingID number, Name varchar); programs(PID number, Funding varchar); In MySQL I can use "WHERE p.Funding = f.FundingID" even though they are different types. This also works in Oracle as long as the varchar column actually holds a number, but if there is a string I get the error:"SQL error: [Oracle][ODBC][Ora]ORA-00918: column ambiguously defined , SQL state S1000 in SQLExecDirect" This is the actual query: "SELECT f.NAME FROM funding f LEFT JOIN programs p ON p.FUNDING = f.FUNDINGID WHERE p.PID = 7") I tried to cast the varchar column as number and tried to_number function, but neither changed anything. Does anyone know of a way I can get around this? Even just suppressing the error would work because I want it to be null if there is no match, but it would have to actually return a result. Quote Link to comment https://forums.phpfreaks.com/topic/117587-solved-comparing-different-type-columns/ Share on other sites More sharing options...
lemmin Posted July 31, 2008 Author Share Posted July 31, 2008 Well, I figured out a way around it: "SELECT DECODE(replace(translate(p.FUNDING,'1234567890','##########'),'#'),NULL,(SELECT f.NAME FROM funding f WHERE f.FUNDINGID = p.FUNDING),p.FUNDING) as testing FROM programs p" It seems a bit ridiculous, but it works. Quote Link to comment https://forums.phpfreaks.com/topic/117587-solved-comparing-different-type-columns/#findComment-604851 Share on other sites More sharing options...
Recommended Posts
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.