Skip to content
Advertisement

ORA-01731: circular view definition encountered

we are migrating over to oracle from sql server side.

on sqlserver we used to have a view like the following

create view blah
AS 
Select column1, 
       column2
 FROM  blah;

but doing this on oracle produces circular view error.

is this not allowed on oracle side?

Advertisement

Answer

You cannot have a view reference itself. It logically does not make sense. A view is essentially a cached query whose results are displayed as a table. How can a query refer to itself?

Indeed, circular view definitions are not allowed in Oracle. If you have a circular view definition, then you likely have a bug in your database code that should be addressed. Perhaps the translation from SQL server to Oracle was flawed and accidentally introduced this circular definition?

User contributions licensed under: CC BY-SA
5 People found this is helpful
Advertisement