Hi All,
I have posted a couple of times but in the wrong forum so hopefully its 3rd time lucky!!
I have an oracle 8i database that i would like to query and update.
There is a table which contains three frequencies which also reference the other frequncies and other arbitrary data.
FREQ OTHER_FREQ OTHER_COL OTHER_COL ETC...
1 2
1 3
2 1
2 3
3 1
3 2
I would like to add a forth frequency.
i thought that i could use an array and have checked out o'reilly's sql book which couldnt help me.
So i have tried to create a temporary table with the frequencies in it, i would like to read each one in turn and run two insert statements.
the code i have is below
I have also found that rownum does not select on rownum,
eg ROWNUM=1 is ok, but ROWNUM=3 gives 0 rows returned.
however ROWNUM<=3 will return 3 rows.
is there another way i can complete this iteration?
TIA
Pete
I have posted a couple of times but in the wrong forum so hopefully its 3rd time lucky!!
I have an oracle 8i database that i would like to query and update.
There is a table which contains three frequencies which also reference the other frequncies and other arbitrary data.
FREQ OTHER_FREQ OTHER_COL OTHER_COL ETC...
1 2
1 3
2 1
2 3
3 1
3 2
I would like to add a forth frequency.
i thought that i could use an array and have checked out o'reilly's sql book which couldnt help me.
So i have tried to create a temporary table with the frequencies in it, i would like to read each one in turn and run two insert statements.
the code i have is below
Code:
create table freq_temp as (select freq from all_freqs ) order by freq asc;
declare
oldfreq number(3) := 12;
newfreq number(3) := 40;
rn number(3) := 1;
begin
for in 1 to (select count (*) from freq_temp)
loop;
oldfreq = (select * from freq_temp where rownum=rn);
insert into all_feq values (newfreq,oldfreq,1,1,1);
insert into all_freq values (oldfreq,newfreq,1,1,1);
rn = rn + 1;
end loop;
end
eg ROWNUM=1 is ok, but ROWNUM=3 gives 0 rows returned.
however ROWNUM<=3 will return 3 rows.
is there another way i can complete this iteration?
TIA
Pete