This discussion is archived
0 Replies Latest reply: Dec 3, 2013 10:10 PM by d38e3030-4028-4199-9f16-dfbb8e1f5a13 RSS

Rows getting jumbled when fetched using OCIStmtFetch2()

d38e3030-4028-4199-9f16-dfbb8e1f5a13 Newbie
Currently Being Moderated

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

 

Legend

  • Correct Answers - 10 points
  • Helpful Answers - 5 points