Skip to main content

Posts

Showing posts from November, 2013

PL/SQL Inserting Top N Records From One Table To Another

declare   cursor c_glr   is       select *       from ( select * from schema_name_x.table_name_x order by id desc) table_x       where rownum <=6       order by rownum;       v_id               schema_name_x.table_name_x.id%TYPE;   v_aciklama     schema_name_x.table_name_x.aciklama%TYPE;   v_kisa_adi      schema_name_x.table_name_x.kisa_adi%TYPE;   v_user_id       schema_name_x.table_name_x.user_id%TYPE;   v_user_date   schema_name_x.table_name_x.user_date%TYPE; begin   for r_glr in c_glr loop       v_id             := r_glr.id;       v_aciklama  := r_glr.aciklama;       v_kisa_adi   := r_glr.kisa_adi;       v_user_id    := r_glr.user_id;       v_user_date := r_glr.user_date;             insert into schema_name_y.table_name_y       values       (         v_id,         1,         null,         1,         nls_upper(v_kisa_adi,'nls_sort=xturkish'),         nls_upper(v_kisa_adi,'nls_sort=xturkish'),         1,         v_aciklama,         &