oracle - insert row in a table using a cursor PL/SQL -


i have procedure in package. problem of package procedure not insert row in table

procedure bcy_alimenta_supporto_g2 is

cursor cur_request (       select p.concurrent_program_name,          u.user_name,          u.user_id,          r.conc_login_id,          r.request_id,          r.request_date,          r.phase_code,          r.status_code,          r.actual_completion_date,          r.argument1,          r.argument2,          r.argument3,          r.argument4,          r.argument5,          r.argument6,          r.argument7,          r.argument8,          r.argument9,          r.argument10     fnd_concurrent_requests r          join fnd_concurrent_programs p             on p.concurrent_program_id = r.concurrent_program_id          join fnd_user u on u.user_id = r.requested_by          join bcy_concurrent_garante_2 bcg             on p.concurrent_program_name = bcg.concurrent_program_name        1 = 1          , r.request_date >= trunc(sysdate) - 2          , r.request_date >= g_start_date          , r.phase_code = 'c'         -- prendo solo le richieste completate          , r.request_id not in (select request_id xxbcyin.bcy_supporto_garante_2));-- non importo le transazioni completate e giĆ  importate il giorno precedente          --order r.request_id asc) ;   ---viene errore      v_status_code varchar2 (4);  gret_code_exception exception;    begin        c in cur_request loop           insert xxbcyin.bcy_supporto_garante_2          values (         bcy_supporto_garante_2_s.nextval,        'query_massiva',        (g_applicazione  || c.user_id),         'c.username',         null,         c.request_date,         null,         null,         null,         null,         null,         null,         null,         null,         g_codice_istituto, --defined before in other procedure of package         null,         null,         null,         null,         null,         'x',         null,         g_tipo_client,  --defined before         null,         null,         null,         null,         null,         v_role_desc,    --defined before         c.conc_login_id,  --defined before         null,         null,         null,         null,         null,         null,         null,         g_applicazione,  --defined before         null,         null,         null,         null,         v_status_code,  --defined before         v_return,         --defined before         'x' ,                null,          null,         c.concurrent_program_name,         c.request_id,         c.phase_code ,         c.status_code,         sysdate);     end loop;        commit; 

with insert there no errors table remains empty!?!. select of cursor correct..the insert has correct number of fields. ideas?

i've never heard of problem oracle using cursor fields in values list, then, don't think i've ever done myself. try this:

dbms_output.put_line( 'inserting ' || c.username ); insert xxbcyin.bcy_supporto_garante_2  select     bcy_supporto_garante_2_s.nextval,     'query_massiva',     (g_applicazione  || c.user_id),     'c.username',     null,     c.request_date,     null,    null,    null,    null,    null,    null,    null,    null,     g_codice_istituto, --defined before in other procedure of package     null,    null,    null,    null,    null,    'x',    null,     g_tipo_client,  --defined before     null,    null,    null,    null,    null,     v_role_desc,    --defined before     c.conc_login_id,  --defined before     null,    null,    null,    null,    null,    null,    null,     g_applicazione,  --defined before     null,    null,    null,    null,     v_status_code,  --defined before     v_return,         --defined before     'x' ,    null,     null,     c.concurrent_program_name,     c.request_id,     c.phase_code ,     c.status_code,     sysdate dual; 

of course, can rewrite insert skipping cursor altogether:

insert xxbcyin.bcy_supporto_garante_2 select bcy_supporto_garante_2_s.nextval,     'query_massiva',     (g_applicazione  || c.user_id),     'c.username',     null,     c.request_date,     etc... whatever_table c everthing_else_as_in_cursor; 

Comments

Popular posts from this blog

javascript - RequestAnimationFrame not working when exiting fullscreen switching space on Safari -

Python ctypes access violation with const pointer arguments -