Home » Developer & Programmer » Forms » need to repeat process until the all data fetched
need to repeat process until the all data fetched [message #611690] Mon, 07 April 2014 05:23 Go to next message
mist598
Messages: 1195
Registered: February 2013
Location: Hyderabad
Senior Member
Hi all,

I am Write code for re filling some data for student with new sit_number . I write this code but get first record only and i need to repeat process until the all data fetched.

Please find the below attached code.

Thank you,
Re: need to repeat process until the all data fetched [message #611691 is a reply to message #611690] Mon, 07 April 2014 05:39 Go to previous messageGo to next message
cookiemonster
Messages: 13915
Registered: September 2008
Location: Rainy Manchester
Senior Member
Not everyone can/will download attachments. You know how to put the code in the thread in code tags, so do so.
Re: need to repeat process until the all data fetched [message #611692 is a reply to message #611691] Mon, 07 April 2014 05:41 Go to previous messageGo to next message
mist598
Messages: 1195
Registered: February 2013
Location: Hyderabad
Senior Member
Please find the attached code.

Re: need to repeat process until the all data fetched [message #611694 is a reply to message #611691] Mon, 07 April 2014 06:00 Go to previous messageGo to next message
mist598
Messages: 1195
Registered: February 2013
Location: Hyderabad
Senior Member
Hi cookiemonster, did you download the file?
Re: need to repeat process until the all data fetched [message #611695 is a reply to message #611694] Mon, 07 April 2014 06:50 Go to previous messageGo to next message
mehboob110233
Messages: 55
Registered: February 2014
Location: Pakistan
Member

BEGIN

for i in ( SELECT a. stud_id,
a.user_stud_id,
a.school_year_id,
a.school_act_year_id,
a.school_act_year_deptid
FROM std_study_level_students a
WHERE user_stud_id NOT IN (SELECT user_stud_id
FROM std_outgoing)
AND school_year_id = (SELECT Max (school_year_id)
FROM std_study_level_students)
ORDER BY a.school_act_year_id,
a.school_act_year_deptid DESC,
To_number(user_stud_id)

loop

INSERT INTO std_numbers_sit_detial
(numbers_sit_id_det,
user_numbers_sit_id_det,
numbers_sit_id,
user_stud_id,
stud_id,
number_sit,
school_year_id,
unversity_year,
school_act_year_id,
user_school_act_year_deptid,
semester_id)
VALUES (std_numbers_sit_detial_sq_1.NEXTVAL,
std_numbers_sit_detial_sq_2.NEXTVAL,
:STD_NUMBERS_SIT.numbers_sit_id,
i.user_stud_id,
i.stud_id,
Std_sit_numbers(i.school_year_id, i.school_act_year_deptid,
:STD_NUMBERS_SIT.numbers_sit_id),
i.school_year_id,
:STD_NUMBERS_SIT.unversity_year,
i.school_act_year_id,
i.school_act_year_deptid,
:STD_NUMBERS_SIT.semester_id);

COMMIT;

END;



I think it work for you.....
Re: need to repeat process until the all data fetched [message #611698 is a reply to message #611694] Mon, 07 April 2014 07:43 Go to previous messageGo to next message
cookiemonster
Messages: 13915
Registered: September 2008
Location: Rainy Manchester
Senior Member
mist598 wrote on Mon, 07 April 2014 12:00
Hi cookiemonster, did you download the file?


My post states that not everyone can/will download the file and asks you to post the code directly in code tags as you normally do.
So why haven't you just posted the code directly as asked?
Re: need to repeat process until the all data fetched [message #611700 is a reply to message #611698] Mon, 07 April 2014 07:44 Go to previous messageGo to next message
cookiemonster
Messages: 13915
Registered: September 2008
Location: Rainy Manchester
Senior Member
@ mehboob110233 - please read and follow How to use [code] tags and make your code easier to read?

Yoy're missing an end loop. However I'd personally just write it as a single insert/select statement.
Re: need to repeat process until the all data fetched [message #611734 is a reply to message #611690] Tue, 08 April 2014 04:54 Go to previous messageGo to next message
mist598
Messages: 1195
Registered: February 2013
Location: Hyderabad
Senior Member
Can you please help me?
Re: need to repeat process until the all data fetched [message #611735 is a reply to message #611734] Tue, 08 April 2014 05:19 Go to previous messageGo to next message
Littlefoot
Messages: 21805
Registered: June 2005
Location: Croatia, Europe
Senior Member
Account Moderator
As Cookiemonster said, rewrite it as a single statement; you don't need PL/SQL for that. Something like
INSERT INTO std_numbers_sit_detial (numbers_sit_id_det,
                                    user_numbers_sit_id_det,
                                    numbers_sit_id,
                                    user_stud_id,
                                    stud_id,
                                    number_sit,
                                    school_year_id,
                                    unversity_year,
                                    school_act_year_id,
                                    user_school_act_year_deptid,
                                    semester_id)
   (SELECT std_numbers_sit_detial_sq_1.NEXTVAL,
           std_numbers_sit_detial_sq_2.NEXTVAL,
           :STD_NUMBERS_SIT.numbers_sit_id,
           a.user_stud_id,
           a.stud_id,
           Std_sit_numbers (a.school_act_year_id,
                            a.school_act_year_deptid,
                            :STD_NUMBERS_SIT.numbers_sit_id),
           a.school_year_id,
           :STD_NUMBERS_SIT.unversity_year,
           a.school_act_year_id,
           a.school_act_year_deptid,
           :STD_NUMBERS_SIT.semester_id
      FROM std_study_level_students a
     WHERE user_stud_id NOT IN (SELECT user_stud_id FROM std_outgoing)
           AND school_year_id =
                  (SELECT MAX (school_year_id) FROM std_study_level_students));
Re: need to repeat process until the all data fetched [message #611862 is a reply to message #611735] Wed, 09 April 2014 08:49 Go to previous message
mist598
Messages: 1195
Registered: February 2013
Location: Hyderabad
Senior Member
Quote:
As Cookiemonster said, rewrite it as a single statement; you don't need PL/SQL for that. Something like


Yes It is working fine now...Thank You Littlefoot... Smile
Previous Topic: How to refresh calling form (Parent form) when called form is closed.
Next Topic: problem in form tree
Goto Forum:
  


Current Time: Tue Mar 19 06:11:10 CDT 2024