I'm having trouble getting a SELECT query in PL/SQL to actually return records from a version in my Oracle SDE. I tried with a query layer too but I just can't seem to get the EXEC sde.version_util.set_current_version('') command to work. I'm using a 10.1 SP1 client. My test SDE database is 10.2
Here's how to recreate my little test environment:
1. In ArcCatalog, create a new point feature class on the SDE named 'MY_FC'
2. Version the feature class
3. Right click on the feature class, then click Manage, and then Create Versioned View. This created a view named MY_FC_VW
4. Create a geodatabase version on the SDE named 'MY_VERSION'. It will be a child of the default version
5. Open ArcMap, add the feature class, point it to the version, and add one point to it, then save edits and stop editing
So now the goal is to run a query from PL/SQL that will return that new point record while it is in that child version, and this is where I get lost. I'm using the ESRI help as a guide (http://resources.arcgis.com/en/help/...000000v000000/)
6. Open PL/SQL and connect to the database
7. Open a SQL window and run the command EXEC sde.version_util.set_current_version('MY_VERSION')
-This is when I get an error ORA-00900: Invalid SQL Statement.
-A coworker recommended trying to run this command in the PL/SQL command window as the following:
BEGIN
EXEC sde.version_util.set_current_version('MY_VERSION')
END;
-But then I couldn't figure out how to run the select statement and see a returned record.
Anyone have any ideas? I ultimately just need to run a query external of ArcGIS that returns all the records in a feature class for a particular version in the geodatabase, and then extract those records to a csv file.
Here's how to recreate my little test environment:
1. In ArcCatalog, create a new point feature class on the SDE named 'MY_FC'
2. Version the feature class
3. Right click on the feature class, then click Manage, and then Create Versioned View. This created a view named MY_FC_VW
4. Create a geodatabase version on the SDE named 'MY_VERSION'. It will be a child of the default version
5. Open ArcMap, add the feature class, point it to the version, and add one point to it, then save edits and stop editing
So now the goal is to run a query from PL/SQL that will return that new point record while it is in that child version, and this is where I get lost. I'm using the ESRI help as a guide (http://resources.arcgis.com/en/help/...000000v000000/)
6. Open PL/SQL and connect to the database
7. Open a SQL window and run the command EXEC sde.version_util.set_current_version('MY_VERSION')
-This is when I get an error ORA-00900: Invalid SQL Statement.
-A coworker recommended trying to run this command in the PL/SQL command window as the following:
BEGIN
EXEC sde.version_util.set_current_version('MY_VERSION')
END;
-But then I couldn't figure out how to run the select statement and see a returned record.
Anyone have any ideas? I ultimately just need to run a query external of ArcGIS that returns all the records in a feature class for a particular version in the geodatabase, and then extract those records to a csv file.