Monday, September 9, 2019

Oracle Pl SQL Cursor

Oracle Pl SQL Cursor


Declare

lv_desc varchar2(1000);

cursor c1 is
   
 select nvl(t.name,rctla.description) name
   from ar_memo_lines_all_tl t,
       ar_memo_lines_all_b b,
       ra_customer_trx_lines_all rctla
   WHERE b.memo_line_id = t.memo_line_id(+)
   and b.MEMO_LINE_ID(+) = rctla.MEMO_LINE_ID
   and b.LINE_TYPE(+) = rctla.LINE_TYPE
   and rctla.CUSTOMER_TRX_ID = :CUSTOMER_TRX_ID
   and rctla.ORG_ID = b.ORG_ID(+)
   and  (t.LANGUAGE = 'US' or t.LANGUAGE is null)
   and (t.org_id = b.org_id or( t.org_id is null and b.org_id is null))
   and rctla.org_id = 82;
begin

lv_desc := null;

FOR type in c1
LOOP
    if lv_desc is null then
    lv_desc := type.name;
    else
    lv_desc := lv_desc||', '||type.name;
    end if;
   
END LOOP;

RETURN lv_desc;


end;

0 comments:

Post a Comment