Please start any new threads on our new
site at https://forums.sqlteam.com. We've got lots of great SQL Server
experts to answer whatever question you can come up with.
| Author |
Topic |
|
aakcse
Aged Yak Warrior
570 Posts |
Posted - 2010-06-21 : 07:52:00
|
| I have a cursorsay like declareCursor c1 for select col1,col2,col3..coln from tab;-- now I want to declare cursor variable -- some thing like cur_var c1%rowtype of oracle-- instead of declaring individual column and then using in the loopRegards,-Neil |
|
|
madhivanan
Premature Yak Congratulator
22864 Posts |
Posted - 2010-06-21 : 08:22:05
|
| What are you trying to do with the cursor?MadhivananFailing to plan is Planning to fail |
 |
|
|
aakcse
Aged Yak Warrior
570 Posts |
Posted - 2010-06-21 : 08:28:25
|
| some calculating in loop using each records value in a cursor.I am working on converting oracle code to sql -Neil |
 |
|
|
madhivanan
Premature Yak Congratulator
22864 Posts |
Posted - 2010-06-21 : 08:31:02
|
quote: Originally posted by aakcse some calculating in loop using each records value in a cursor.I am working on converting oracle code to sql -Neil
Post some sample data with expected resultIn Oracle, you need to use cursor for most of the times. It is not needed in SQL ServerMadhivananFailing to plan is Planning to fail |
 |
|
|
aakcse
Aged Yak Warrior
570 Posts |
Posted - 2010-06-21 : 09:05:58
|
A cursor is declared as below--oraclecursor c1 is select--big list of columnscol1...colnfrom tablewhere....group by....cur_var C%ROWTYPE;open c1; LOOP fetch c1 into cur_var; EXIT when c1%NOTFOUND; --lot of processing is done here, which I have converted in to sql--4 leangthy if block etcend loop; close pos_cursor; I just need to convert the declaring opening & closing of cursor.Regards-Neil |
 |
|
|
aakcse
Aged Yak Warrior
570 Posts |
Posted - 2010-06-21 : 09:13:35
|
| It is a one time job to run this proc, is it is slow in performance it is ok.-Neil |
 |
|
|
|
|
|