• Post Reply Bookmark Topic Watch Topic
  • New Topic
programming forums Java Mobile Certification Databases Caching Books Engineering Micro Controllers OS Languages Paradigms IDEs Build Tools Frameworks Application Servers Open Source This Site Careers Other Pie Elite all forums
this forum made possible by our volunteer staff, including ...
Marshals:
  • Campbell Ritchie
  • Tim Cooke
  • paul wheaton
  • Jeanne Boyarsky
  • Ron McLeod
Sheriffs:
  • Paul Clapham
  • Liutauras Vilda
  • Devaka Cooray
Saloon Keepers:
  • Tim Holloway
  • Roland Mueller
Bartenders:

Cursor Inside if is it Possible?

 
Ranch Hand
Posts: 48
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Hi Guys,,

is it possible for me to Declare cursor inside if or if statement inside cursor?

if possible how could i make it?

because i just made cursor like this



But I got This error


any Help would be appreciate

thanks in advance
 
Ranch Hand
Posts: 182
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
There are several way that comes to my mind
1. Why not declare 2 different cursors than use if statements to decide which cursor will be opened?
2. If you need some kind of fancy cursor declaration, you may union both SQLs (they need to select same types) and then make only one of them fetches data. Something like this

3. You may use dynamic sql with open cursor for ... using ... OPEN-FOR-USING

You may extend the list, but simple is safer so if I were you I would go for 1.
 
leonardo ginting
Ranch Hand
Posts: 48
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
hi fatih thanks for replying

i already use point 1 as your suggestion

and thanks for your help
 
She said she got a brazillian. I think owning people is wrong. That is how I learned ... tiny ad:
Smokeless wood heat with a rocket mass heater
https://woodheat.net
reply
    Bookmark Topic Watch Topic
  • New Topic