Oracle 12c - Issue in PL/SQL -


i have following block of code:

declare   cursor c_cursor     select *       table_a;      in c_cursor loop     if i.id not in (select id table_b ind_val='y')            begin         insert val_table_err         values (''error:id''|| i.id,                 1,                 1,                 null,                 1,                 i.type_cd);       end;     end if;     end loop;  

i getting error pls-00405: subquery not allowed in context

any resolve issue appreciated.

you can't not in in version of oracle.

it make sense put not in clause cursor definition. assuming not in rather not exists more efficient approach, work.

cursor c_cursor     select *       table_a      a.id not in (select b.id                           table_b b                          ind_val = 'y'); 

if want check done within loop, you'd need different construction. like

for in c_cursor  loop   select count(*)      l_cnt     table_b b    b.id = i.id      , b.ind_val = 'y';    if( l_cnt = 0 )       <<do something>>   end if; end loop; 

of course, won't efficient or clear filtering out loans in cursor in first place.


Comments

Popular posts from this blog

java - How to specify maven bin in eclipse maven plugin? -

single sign on - Logging into Plone site with credentials passed through HTTP -

php - Why does AJAX not process login form? -