View previous topic :: View next topic
|
Author |
Message |
puppalso
New User
Joined: 07 Dec 2007 Posts: 8 Location: Pune
|
|
|
|
Hi,
Please let me know the differences b/w declaring the cursor in data division Vs declaring the cursor in procedure division.
Regards,
Soma |
|
Back to top |
|
|
dbzTHEdinosauer
Global Moderator
Joined: 20 Oct 2006 Posts: 6966 Location: porcelain throne
|
|
|
|
1. If you declare it in data division, you know that the DECLARE .. CURSOR will come before an open/fetch/close.
2. if you declare it in the data division, you don't have simpletons checking the sql code after the declare. |
|
Back to top |
|
|
puppalso
New User
Joined: 07 Dec 2007 Posts: 8 Location: Pune
|
|
|
|
except those u have mentioned, are there any issues with declaring the cursor in data division . |
|
Back to top |
|
|
sharad_shanu
New User
Joined: 03 Oct 2006 Posts: 40
|
|
|
|
Hi,
DECLARE is just a declaration, not a executable statement. It will give same results in both cases i.e. whether it is defined in Data Division or Procedure Division.
Reference:
• Q26 of www.geocities.com/*****/DB2.html
Regards,
Sharad Srivastava |
|
Back to top |
|
|
puppalso
New User
Joined: 07 Dec 2007 Posts: 8 Location: Pune
|
|
|
|
Hi
Will there be any difference in declaring the cursor in data division while using in case of static sql/dynamic sql |
|
Back to top |
|
|
sharad_shanu
New User
Joined: 03 Oct 2006 Posts: 40
|
|
|
|
Well,
As per my understanding, there should not be any difference.
Only things that matters is that, cursor should be declared before it is getting executed.
Correct me if I am wrong.
Regards,
Sharad Srivastava |
|
Back to top |
|
|
puppalso
New User
Joined: 07 Dec 2007 Posts: 8 Location: Pune
|
|
|
|
Hi all,
Thanks for the clarification.
As of my knowledge there won't be any difference.
but for clarification i have posted this.
Thanks a lot... |
|
Back to top |
|
|
|