Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations Mike Lewis on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

How to match two tables having different data formet

Status
Not open for further replies.

ancheswaroop

Programmer
Apr 25, 2006
12
US
I have to match two tables with one columns
but columns are with different data formet
columns 1 having data as +000000150.20 and
columns 2 data as 000150.20

data type of this columns=char

how can i match this two tables
 
If the formats are consistent throughout the columns, then you could join with

WHERE SUBSTR(column1, -9,9) = column2;



 
SUBSTR(column1, -9,9) is a call to the substring function.
column1 is the name of your column.
-9 is the position in column1 that is 9 characters from the rightmost end to the string. 9 is the number of characters you want in your string.

When in doubt about syntax, you can (and really should) look up the details for the function in your Oracle reference manual. This way, you will learn more about Oracle in a shorter amount of time.
 
Ancheswaroop,

Can you please confirm the following:

1) What are the column definitions for "column1" and "column2"? Are they NUMBER, VARCHAR, CHAR, CLOB?

2) For your puposes, are the values "150.2" and "+000000150.20" equal? (If so, then you are looking for algebraic/arithmetic/numeric equality; if they are not equal, then you are looking for bit/character equality.)

Let us know,

[santa]Mufasa
(aka Dave of Sandy, Utah, USA)
[I can provide you with low-cost, remote Database Administration services: see our website and contact me via www.dasages.com]
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top