0 Replies Latest reply on Dec 4, 2013 6:10 AM by 1058337

    Rows getting jumbled when fetched using OCIStmtFetch2()

    1058337

      I have a hierarchical data structure in one of my table called parts.

      The structure of the table is something like this

      ParentPart, ComponentPart, Data

      P1,P2,xyz

      P2,P3,xyz

      P3,P4, xyz

      P4,P5, xyz

      P7,P8, xyz ……

      …..

      ….

       

      When I fire a connect by query to traverse the relationship starting with part P1 in sqlplus then I get

      Following output.

      P1,P2,xyz

      P2,P3,xyz

      P3,P4, xyz

      P4,P5, xyz

       

      However when I fire the same query using OCI APIs and fetch the results using  OCIStmtFetch2 API then I get jumbled output. I am getting Row P3,P4, xyz as the first row in the data buffer.

      I found that the rows in the data buffer are jumbled and differ from the SQLplus output.

      I am using scrollable cursors to fetch the data. And using Oracle 11.2.0.2 database.

       

      My questions are:

      1. Why the rows are getting jumbled when fetched using OCIStmtFetch2 API.
      2. What SQLplus is doing to display the output in logically correct order.

       

      Thanks,

      Sumit