oracle - referencing a variable from another procedure in plsql -


i have written package :

create or replace     package body new_hire_pkg         procedure load_emp(         errbuf out varchar2,         retcode out varchar2 )           cursor cur_person_info               select * table_abc;       cursor cur_person_adr               select * table_adr;       l_person_id      number;       l_emp_num        number;       lv_add_type      varchar2(100);       lv_address_line1 varchar2(100);     begin       person_info_rec in cur_address_info       loop         hr_employee_api.create_employee ( p_validate => false,         --input parameter         p_hire_date =>person_info_rec.date_start,         -- output         p_employee_number => lc_employee_number, p_person_id => ln_person_id );       end loop ;     end;  procedure load_add(             errbuf out varchar2,             retcode out varchar2 )  ln_person_id number;          begin           address_info_rec in cur_address_info           loop             begin               hr_person_address_api.create_person_address                (p_validate => false,               p_effective_date => trunc(sysdate),               p_person_id=> ln_person_id,                  --output               p_address_type => lv_add_type,               p_address_line1 => lv_address_line1);             end;           end loop;         end;       end;  

now in procedure load_add there variable ln_person_id should person ids generated in procedure load_emp. want pass in procedure 1 one. can making ln_person_id object ?

judging code have 2 concurrent programs - 1 calls load_emp() , 1 calls load_add(). if that's structure want 2 calls run in separate sessions , there's nothing can pass variable 1 other. best hold person_id values load_emp in custom table. data later consumed load_add().

however restructure package. why not call load_add() within loop in load_emp() ?


Comments

Popular posts from this blog

java - nested exception is org.hibernate.exception.SQLGrammarException: could not extract ResultSet Hibernate+SpringMVC -

sql - Postgresql tables exists, but getting "relation does not exist" when querying -

asp.net mvc - breakpoint on javascript in CSHTML? -