Three things occur to me.
I presume this is some test you are working on. But you have defined both cursors to execute exactly the same query. So that is one reason why you might be getting duplicate rows. Certainly, the lack of clear business logic in your question makes it hard for us to understand what you are trying to achieve.
The second is, you have a nested loop, looping through the records of one table within the records of another table. But you have neglected to join the rows selected by the inner cursor with the current row of the outer cursor. So each row in the vend_cursor
will fetch the entirely the same set of rows within the product_cursor
.
Lastly, the product_cursor
is not sorted or filtered by the distinct
keyword. Given the two previous points this may not matter. I just mention it for the sake of completeness.