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
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