Posts

Showing posts from December, 2013

PL/SQL Inserting Big Data Using Refcursor and Fuction

--Inserting big data using refcursor and function

declare
  cursor c_beyan
  is
  select *
  from ilc_beyan
  order by id;

    v_KENTLI_ID           ilc_beyan.kentli_id%TYPE;
    v_ISLEM_ADRESLERI_ID  ilc_beyan.islem_adresleri_id%TYPE;
    v_HESAP_ID            ilc_beyan.hesap_id%TYPE;
    v_DONEM_YILI          ilc_beyan.donem_yili%TYPE;
    v_DONEM_AYI           ilc_beyan.donem_ayi%TYPE;
    v_BIRIM_ADET          ilc_beyan.birim_adet%TYPE;
    v_ACIKLAMA            ilc_beyan.aciklama%TYPE;
    v_BEYAN_TUTARI        ilc_beyan.beyan_tutari%TYPE;
    v_KAPANIS_ID          ilc_beyan.kapanis_id%TYPE;
    v_counter number      :=0;

begin
    for r_beyan in c_beyan loop
        v_KENTLI_ID           :=r_beyan.kentli_id;
        v_ISLEM_ADRESLERI_ID  :=r_beyan.islem_adresleri_id;
        v_HESAP_ID            :=r_beyan.hesap_id;
        v_DONEM_YILI          :=r_beyan.donem_yili;
        v_DONEM_AYI           :=r_beyan.donem_ayi;
        v_BIRIM_ADET          :=r_beyan.birim_adet;
        …

PL/SQL Exists Condition

select *
from table_x x
where exists (select *
              from table_y y
              where x.id = y.x_id);