Jamal, February 17, 2016 - 5:39 pm UTC
Thanks
now , i want to store time interval in a table using cursor, but i am unable to do this , as instead of increment , only the initial value is being returned
example
for i in 1..rec_visits.visits (say 10)
loop
insert into TEST_TIME(time)
values(days.day*i);
end loop;
where days is cursor
cursor days is
select to_char(d_day+.25,'DDHH24MI"Z"MONRR') days from tab_days;
February 18, 2016 - 10:53 am UTC
I'm not clear what you're trying to do. But if you want to take the results from your query and put them in another table, you don't need a cursor. You can do a insert-select:
insert into TEST_TIME (time)
select to_char(d_day+.25,'DDHH24MI"Z"MONRR') days from tab_days;
Looking forward for solution
Jamal, February 18, 2016 - 4:04 am UTC
hi, i am looking forward for a solution.kindly help me.
February 18, 2016 - 10:54 am UTC
Remember we have other people's questions to answer and lives outside AskTom too!
Answer awaited
A reader, February 18, 2016 - 12:23 pm UTC
please help as my work is stalled. i thinks this is the most appropriate forum from where i can get requisite help/assistance.
February 18, 2016 - 2:51 pm UTC
I'm not clear what it is you're trying to do. As I said in an earlier response if you want to take the values from tab_days and put them in a new table, you just need an insert-select.
If this doesn't help then please post a complete description of your problem. This should include:
- A description of the problem in words (e.g. I need insert rows into t. These are calculated as...)
- The input you have
- The output you want
- Why what you're trying doesn't do this
ZULU date insert with multiple rows insert
A reader, February 18, 2016 - 4:16 pm UTC
Hi
Here is detail of the problem
i am inserting data in a temporary tables 1)
1. A table temp_iterations which contains information such as
temp_iteration( group varchar2(30) ,number_of_iteration number,Day_id varchar2(10))
2. A table which contains information regarding groups
such as group ,first_time_to_carry_out_action [in zulu format) , number_of_iterations
temp_iteration is:- (group varchar2, time_of_iteration date in zulu ,, number_of_iteration)
I am maintaining another table which contains action_sart_date date
I am keeping data of group and iterations in another table
temp_repeats(group,iteration ,day_id)
('G1',2.,Day-1')[ Day-1 will be determined by difference of 1 day from action_start_date]
('G1',4,'Day-2')
to achieve this i am using nested cursors
--------------------------------
declare
-----to determine number of iterations for each grp----
cursor grp_iterations
is select grp, iterations from temp_iterations;
------- to determine the grp-------
cursor grp_inserts is
select grp from temp_grps;
------ to relate actions with start date-----
cursor days is
select to_char(st_day+.25,''DDHH24MI"Z"MONRR') st_day from tab_days;
rec_iteration grp_iterations%rowtype ;
rec_grps grp_inserts%rowtype;
rec_days days%rowtype;
begin
open grp_iterations;
LOOP
FETCH grp_iterations INTO rec_iterations;
exit when grp_iterations%notfound;
open grp_inserts ;
FETCH grp_inserts INTO rec_grps;
open days;
fetch days into rec_days;
for i in 1..rec_iterations.iterations
loop
insert into TEST_grps (grp,time_of_iteration) -----[the end resul table]
values(grp_inserts.grp,rec_days.st_day)-----it should be incremented;
end loop;
end loop;
end;
As it is evident while i am inserting one record for temp tables i want to insert multiple records in TEST_grps based on number of iteration value .
February 19, 2016 - 10:33 am UTC
See the answer to your other question.
hi experts
A reader, February 18, 2016 - 4:27 pm UTC
ref your answer
insert into TEST_TIME (time)
select to_char(d_day+.25,'DDHH24MI"Z"MONRR') days from tab_days;
how can i do it in a loop
ie first time increment is .25
for second time increment is .50 and so on
i appreciate your response
February 19, 2016 - 10:34 am UTC
See the answer to your other question