Click here to Skip to main content
15,887,923 members
Please Sign up or sign in to vote.
4.00/5 (1 vote)
See more:
Hello,

These days I am facing with a problem related to text datatype differences between Oracle and SQL-Server.
More exactly I am comparing a concatenation of chars from Oracle with a varchar field from MS-SQL.
Here are the condition:

SQL
rtrim(NUM1) || ' ' || rtrim(NUM2) <> D2.NUM

and it is launched from Oracle.

Where NUM1 & NUM2 are varchar2 data type from Oracle while NUM is varchar from MS-SQL.
I want that the condition to be false but, unfortunatelly it is true.
Normally, both vatiables have same value = '7 a' but they are not recognized as being the same.

I was trying to manully do a hardcoded comparison, meaning '7 a' <> D2.NUM which are false, because Oracle consider that they are the same value but when I am comparing rtrim(NUM1) || ' ' || rtrim(NUM2) with '7 a', Oracle consider that they are different.

Does anyone have any idea why Oracle consider that rtrim(NUM1) || ' ' || rtrim(NUM2) <> '7 a' is true?

Thank you very much,
Mikcutu.
Posted
Updated 8-May-13 3:11am
v2
Comments
Maciej Los 8-May-13 15:51pm    
Did you try other inequality operator, for example: != or ^= ?
http://docs.oracle.com/html/A95915_01/sqopr.htm#i1004774[^]
mikcutu 9-May-13 4:57am    
Yes, and the result is the same :(

1 solution

Hello everybody,

I managed to get a solution for my problem using another table where were inserted all selected data from my sentence + an extra field which contains the concatenation
SQL
rtrim(NUM1) || ' ' || rtrim(NUM2) 


After that, I compared just 2 simple fields and the values were identically (as they should have been from the begining).

Thank you all who had a look over my problem.
 
Share this answer
 

This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)



CodeProject, 20 Bay Street, 11th Floor Toronto, Ontario, Canada M5J 2N8 +1 (416) 849-8900