Skip to Main Content

SQL & PL/SQL

Announcement

For appeals, questions and feedback about Oracle Forums, please email oracle-forums-moderators_us@oracle.com. Technical questions should be asked in the appropriate category. Thank you!

Interested in getting your voice heard by members of the Developer Marketing team at Oracle? Check out this post for AppDev or this post for AI focus group information.

Fetching a cursor and inserting into another table

2710529Jul 14 2014 — edited Jul 15 2014

I have written a procedure which will fetch data from one table (table A) and insert into another table (table B). Bu using cursor i have done this. I want to keep a flag into table A which will be updated after inserting the data into table B. So that, I can be sure which data has already been transferred to table B.

But I am not sure how I shall update the table A.

My procedure is like this:

DECLARE

var_sl number(20);

var_inout varchar2(100);

var_door varchar2(100);

var_lsts varchar2 (100);

CURSOR att_cur is select "SL","in_out","DoorNo","L_Status" from access5@ATTENDANCE;

BEGIN

OPEN att_cur;

loop

fetch att_cur into var_sl,var_inout,var_door,var_lsts;

insert into apscl_attendance(SL,ACCESS_FLAG,GATE_NO,L_STATUS)

values (var_sl,var_inout,var_door,var_lsts);

update access5@ATTENDANCE set "Uploaded"=1:

EXIT WHEN att_cur%NOTFOUND;

end loop;

CLOSE att_cur;

END;

Comments
Locked Post
New comments cannot be posted to this locked post.
Post Details
Locked on Aug 12 2014
Added on Jul 14 2014
9 comments
6,314 views