This week's book giveaways are in the Java EE and JavaScript forums.
We're giving away four copies each of The Java EE 7 Tutorial Volume 1 or Volume 2(winners choice) and jQuery UI in Action and have the authors on-line!
See this thread and this one for details.
The moose likes Oracle/OAS and the fly likes Cursor Inside if is it Possible? Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login


Win a copy of The Java EE 7 Tutorial Volume 1 or Volume 2 this week in the Java EE forum
or jQuery UI in Action in the JavaScript forum!
JavaRanch » Java Forums » Products » Oracle/OAS
Bookmark "Cursor Inside if is it Possible?" Watch "Cursor Inside if is it Possible?" New topic
Author

Cursor Inside if is it Possible?

leonardo ginting
Ranch Hand

Joined: Jul 25, 2011
Posts: 48
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
Fatih Keles
Ranch Hand

Joined: Sep 01, 2005
Posts: 182
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

Joined: Jul 25, 2011
Posts: 48
hi fatih thanks for replying

i already use point 1 as your suggestion

and thanks for your help
 
I agree. Here's the link: http://aspose.com/file-tools
 
subject: Cursor Inside if is it Possible?