I am trying to write a stored procedure in Oracle to fetch data from a particular version, by using the sde.version_util.set_current_version function. When I run the following statement individually in SQL Developer, it works fine.
EXEC sde.version_util.set_current_version('My Version Name');
It shows a message in SQL Developer as -> anonymous block completed
After this I can query this version to get the data that I want.
However when I try to use the same statement in a stored procedure it gives following error ->
- Error(12,8): PLS-00103: Encountered the symbol "SDE" when expecting one of the following: := . ( @ % ; The symbol ":=" was substituted for "SDE" to continue.
If I use EXECUTE IMMEDIATE (as given below) instead of EXEC, then I get a different error.
EXECUTE IMMEDIATE sde.version_util.set_current_version('My Version Name');
- Error(12,21): PLS-00222: no function with name 'SET_CURRENT_VERSION' exists in this scope
ArcGIS geodatabase is 10.4.1 and database which we're using is Oracle 12g.
Can someone suggest how this function has to be used in a stored procedure?
Once this statement gets executed, I want to select some data from versioned view in a cursor.