With the old data-provider from MS System.Data.OracleClient I was able to query the text of an oracle-view with the following code:
...
cmd.CommandText = "select text from all_views where view_name = 'MY_VIEW'";
var viewText = cmd.ExecuteScalar();
...
Now with the new (native) provider Oracle.ManagedDataAccess.Client this isn't possible anymore. The same code (and any other attempts) run without exception, but the result is always String.Empty (not null).
In fact, the command is executed (all other columns from all_views are queriable). Only 'text' remains empty. Therefore I am afraid of a mistake in the oracle-provider.
Does anybody know an answer or an alternative method? Thx in advance.
text
in all_views
is a long
for backwards compatibility reasons but that data type has been deprecated for a couple of decades now so it's often a pain to work with. You probably can adapt your code to work with a long
correctly but you're probably better off using
select dbms_metadata.get_ddl( 'VIEW', 'MY_VIEW' )
from dual
to get the DDL for the view as a clob
instead.