Monday, March 3, 2008

ORA-01445: cannot select ROWID from a join view wihtout a key-preserved table.

Today, I was building an huge query, after adding another branche, the query returned me this strange error :

ORA-01445: cannot select ROWID from a join view wihtout a key-preserved table.
My query was something like this :
select * from tableA a join tableB b on (a.column = b.column)
No row_ids...

After struggling with it for a while, I search metalink, and after all it was Oracle thats causing my problems.... Oracle(9) has a limit of 1050 columns in any query that uses ANSI joins. So I've changed my query to :
select * from tableA a join (select column from tableB) b on (a.column = b.column)
This way I've reduced my query colums and my problem was solved.