下面的代码返回一个空记录,但给出了来自 SQL+ 的记录。
DbProviderFactory factory = DbProviderFactories.GetFactory("Oracle.DataAccess.Client");
DbConnection connection = factory.CreateConnection();
connection.ConnectionString = "Data Source=(DESCRIPTION=(ADDRESS_LIST=(ADDRESS=(PROTOCOL=TCP)(HOST=Simplex-IT-02)(PORT=1521)))
(CONNECT_DATA=(SERVER=DEDICATED)(SERVICE_NAME=Simplex))); User Id=User_Test;Password=password;";
DataTable table = new DataTable();
DbCommand command = connection.CreateCommand();
command.Connection = connection;
command.CommandText = "SELECT text FROM user_views WHERE (view_name='ACCOUNT_BALANCES_BY_PERIOD');";
DbDataReader dataReader = command.ExecuteReader();
table.Load(dataReader);
dataReader.Close();
同时,当我用“SELECT DISTINCT view_name FROM user_views”替换 command.CommandText 时,它给了我给定模式的所有可用视图的列表。
为什么我无法获取给定视图的 sql 文本?