What is Good...CURSOR or PLAIN SELECT Statement...
Posted on 2004-10-13
I am writing a procedure. I am starting with opening a cursor and looping through each record. Now for each record I have to get other details from 5 different tables. I am plannig to create five different parametric cursors for all five tables. Also, I am planning to pass PK to these cursors to fetch data for the record fetched by first cursor.
First cursor is must...I know that all the five tables are going to return me one single record for the passed PK.
Is cursor approach is good ??? or should I just get the data using simple SELECT statement with WHERE clause ??? I am looking for SPEED ...I am expecting, first cursor will return 2000 rows. That means if I am using CURSOR approach I am using five tables cursor 2000 times. Where as using SELECT statement I am hitting DB table directly each time for getting the record.