Protected by Copyscape Web Copyright Protection Software

Search This Blog

Wednesday, March 12, 2014

Query To Find Common Columns Between Tables

Hi All,

The following Query will help to get join conditions between tables.

SELECT column_name
  FROM dba_tab_cols --all_tab_cols
 WHERE table_name = 'PO_HEADERS_ALL'
INTERSECT
SELECT column_name
  FROM dba_tab_cols --all_tab_cols
 WHERE table_name = 'AP_INVOICES_ALL'

Kindly note that This will just give an Idea but not exact join conditions, i.e In above query have so many columns which are common in two tables. ATTRIBUTE1 is in two tables but we can't join with this. So be careful while building query.

Thanks,
K. Rajashekar Reddy