Code: Select all
"SELECT version FROM sys.v_$instance"
The query syntax is not valid., line 1, column 27
Below is a code snippet that causes the error:
Code: Select all
DbConnection conn = (System.Data.EntityClient.EntityConnection)context.Connection;
ConnectionState initialState = conn.State;
try
{
if (initialState != ConnectionState.Open)
conn.Open(); // open connection if not already open
try
{
using (DbCommand cmd = conn.CreateCommand())
{
// todo: fix the v_$ error
cmd.CommandText = "SELECT edition FROM sys.v_$instance";
r = cmd.ExecuteReader();
if (r.HasRows)
{
r.Read();
_databaseEdition = r.GetValue(0).ToString();
}
}
}
catch (Exception ex)
{
// eat the error
}
}
finally
{
if (initialState != ConnectionState.Open)
conn.Close(); // only close connection if not initially open
}
Code: Select all
@"SELECT version FROM sys.v_\$instance", "SELECT version FROM sys.v_\$instance", "SELECT version FROM sys.v_\u0024instance"
Is threre any way to query the Oracle system objects that contain a dollar sign?
Thanks,
Welton