Home » SQL & PL/SQL » SQL & PL/SQL » procedure with loop (oracle 11g)
procedure with loop [message #621193] Mon, 11 August 2014 08:55 Go to next message
tuckersuz
Messages: 26
Registered: July 2009
Junior Member
I need to write a procedure that uses a numeric For Loop with 10 iterations.

The first five iterations should assign the variables school_yr and semester to 2010 and SPRING respectively.
The second five iterations should assign the variables school_yr and semester to 2012 and FALL respectively.

Each iteration should print out school_yr and semester on one line.

The output should look like this:
2010/SPRING
2010/SPRING
2010/SPRING
2010/SPRING
2010/SPRING
2012/FALL
2012/FALL
2012/FALL
2012/FALL
2012/FALL

How can I do this?

thanks
Re: procedure with loop [message #621194 is a reply to message #621193] Mon, 11 August 2014 08:59 Go to previous messageGo to next message
BlackSwan
Messages: 23070
Registered: January 2009
Senior Member
Please read and follow the forum guidelines, to enable us to help you:

http://www.orafaq.com/forum/t/88153/0/ and read http://www.orafaq.com/forum/t/174502/
Re: procedure with loop [message #621195 is a reply to message #621193] Mon, 11 August 2014 09:00 Go to previous messageGo to next message
Michel Cadot
Messages: 59821
Registered: March 2007
Location: Nanterre, France, http://...
Senior Member
Account Moderator

http://www.orafaq.com/forum/m/620874/#msg_620874

In addition, we never had any feedback or thank for our time and answers, why should we continue to help you?

[Updated on: Mon, 11 August 2014 09:00]

Report message to a moderator

Re: procedure with loop [message #621196 is a reply to message #621193] Mon, 11 August 2014 09:01 Go to previous messageGo to next message
Lalit Kumar B
Messages: 2522
Registered: May 2013
Location: World Wide on the Web
Senior Member
1. Where are these values coming from?
2. Why plsql, why not sql?
3. Why didn't you post a test case?
4. What did you try so far?
Re: procedure with loop [message #621197 is a reply to message #621193] Mon, 11 August 2014 09:08 Go to previous messageGo to next message
John Watson
Messages: 4812
Registered: January 2010
Location: Global Village
Senior Member
This is the same question you asked last week, isn't it?

http://www.orafaq.com/forum/mv/msg/193941/620874/#msg_620874

You said then that the rows were returned from queries, and Lalit gave you a solution. Was something wrong with it?
Re: procedure with loop [message #621198 is a reply to message #621195] Mon, 11 August 2014 09:17 Go to previous messageGo to next message
tuckersuz
Messages: 26
Registered: July 2009
Junior Member
Thanks Michel:

I did post this question twice. Apologies.

Re: procedure with loop [message #621200 is a reply to message #621198] Mon, 11 August 2014 09:32 Go to previous message
Lalit Kumar B
Messages: 2522
Registered: May 2013
Location: World Wide on the Web
Senior Member
Feedback? Cross-post doesn't help to gain attention in getting answers quickly, rather, it annoys the folks willing to help.

You apologized, ok, now feedback please.
Previous Topic: How can I get the distinct rows?
Next Topic: Testing for Numeric when a varchar is passed in
Goto Forum:
  


Current Time: Fri Nov 28 23:26:54 CST 2014

Total time taken to generate the page: 0.10324 seconds