Error: ???Unable to complete operation??? on querying the layer

Discussion created by vinayaksj on Mar 28, 2013
Latest reply on Mar 28, 2013 by vinayaksj

We are getting an error �??Unable to complete operation�?� when we are trying to query using the interface provided by the rest URL.

Environment Details:
�?� Operating System: Windows 7
�?� Arc GIS 10.1 SP1 for Server
�?� Arc GIS 10.1 SP1 for Desktop

The rest url for query is like below

Following Where clause is failing with �??Unable to complete operation�?� error.
ID IN (select * from table(demo_pkg.get_ids('211805')))

We have created a package demo_pkg in our database and the package has a get_ids function like below and returns pipelined list of objects IDs to be used for filtering.

FUNCTION get_ids(list_ids VARCHAR2)
      RETURN numeric_table_t
OPEN vcursor FOR strsql;
               FETCH vcursor
                  INTO identifier;
               EXIT WHEN vcursor%NOTFOUND;
               rec.identifier := identifier;
               PIPE ROW(rec);
            END LOOP;

A simple where clause however returns correct value:
ID IN (1234, 5678)

Please let us know how to fix this issue as the query with package run is working fine in Arc GIS 10.0 Setup.
We have now upgraded to Arc GIS 10.1 SP1 on another machine and are facing this issue in 10.1 environment.

Error details in ArcGIS Server Log shows:
Geodatabase error: An invalid SQL statement was used. An invalid SQL statement was used. [PSW_XXX]. An invalid SQL statement was used. [SELECT ID, NAME, Shape FROM MY_TABLE WHERE ID IN (select * from table(demo_pkg.get_ids('211805')))].
Code: 10837
Method Name: MapServer.Query

-Thanks in advance