Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- create x_table
- (
- id number,
- value varchar2(100)
- );
- insert into x_table (id, value ) values (1, 'One');
- insert into x_table (id, value ) values (2, 'Two');
- commit;
- declare
- cursor x_cur (p_id number) is
- select *
- from x_table;
- type x_type is table of x_cur%rowtype index by pls_integer;
- x_rec x_type;
- x_rec2 x_type;
- begin
- open x_cur(1);
- fetch x_cur
- into x_rec;
- close x_cur;
- open x_cur(2);
- fetch x_cur
- into x_rec2;
- close x_cur;
- for i in 1..x_rec2 loop -- outer loop because this is the new record
- for x in 1..x_rec loop -- outer loop because this is the old record
- this_is_a_pkg.do_something(p_new_id => x_rec2(i).id
- p_old_value => x_rec(x).value)
- end loop;
- end loop;
- end;
- declare
- cursor x_cur (p_id number) is
- select *
- from x_table;
- cursor x_cur2 (p_id number) is
- select *
- from x_table;
- type x_type is table of x_cur%rowtype index by pls_integer;
- x_rec x_type;
- x_rec2 x_cur2;
- begin
- open x_cur(1);
- fetch x_cur
- into x_rec;
- close x_cur;
- open x_cur(2);
- fetch x_cur
- into x_rec2;
- close x_cur;
- for i in 1..x_rec2 loop -- outer loop because this is the new record
- for x in 1..x_rec loop -- outer loop because this is the old record
- this_is_a_pkg.do_something(p_new_id => x_rec2(i).id
- p_old_value => x_rec(x).value)
- end loop;
- end loop;
- end;
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement