Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations IamaSherpa on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

PLSQL loop

Status
Not open for further replies.

jrtex

Programmer
Dec 7, 2000
11
US
I'm trying to find a way to write a better, shorter script to loop thru some table data that has similar field names. The example would be that I have a table with fields defined like category_01, category_02, category_03, etc...

In trying to create a simple loop is there a way to do it in PLSQL that would allow you to do something like

while loopval < 10 loop
loopval := loopval + 1;
select * from temptable where 'category_' || loopval > 0;
end loop;

Currently I have to go thru each field 10 different times for 30 different occurences of another outer loop which makes for a long script and a lot of busy work cutting, pasting and editing of the lines. Is there anyway to concatenate the beginning of the field name with another value.

Any ideas would be appreciated.

JR
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top