AnsweredAssumed Answered

Database.OpenTable work very selective, throws exception otherwise

Question asked by TomGeo on Jan 30, 2019
Latest reply on Feb 1, 2019 by TomGeo

To minimize the overhead I am asking an Oracle database table only for specific objects through the OpenTable method.

While it works with in the first attempt, all others fail. I do not know what the issue is but I am getting an ArcGIS.Core.Data.GeodatabaseQueryexception thrown when trying to open the table based on my query description.

 

Below is the code how I am trying to get the data. The exception thrown is pointing to "Geometry is null geometry" which is strange since I can find multiple objects that fulfil the SQL statement.

public async void SearchValidationTables()
        {
            await QueuedTask.Run(() =>
            {
                using (Database ValidationDatabase = new Database(connectionFileValidation))
                {
                    // get national string prefix
                    string nationalStringPrefix = "";
                    SQLSyntax sqlSyntax = ValidationDatabase.GetSQLSyntax();
                    nationalStringPrefix = sqlSyntax.GetSupportedStrings(SQLStringType.NationalStringPrefix).First();
                    // build query here and set it into next line
                    string querySQL = "SELECT * FROM SCHEMA.DBTABLE WHERE FEATURETYPE = "+ nationalStringPrefix +"'waterways'";
                    QueryDescription queryDescription = ValidationDatabase.GetQueryDescription(querySQL, "test");
                    // set the column with a unique identifier
                    queryDescription.SetObjectIDFields("OBJECTID");
                    // get data as featureclass and load it as featurelayer
                    try
                    {
                        FeatureClass fcFromTable = ValidationDatabase.OpenTable(queryDescription) as FeatureClass;
                        LayerFactory.Instance.CreateFeatureLayer(fcFromTable, MapView.Active.Map);
                    }
                    catch (GeodatabaseQueryException e)
                    {

                        throw e;
                    }
                   
                }
            });
        }

 

I found a bit more information by looking at the inner exception:

 

 

Does that mean I have to adjust the QueryLayerName?

Outcomes