hi, I have created this procedure. but my require is, i have to pass table name as parameter and use this table in for loop. like
CREATE OR REPLACE PROCEDURE CES_INT_PAYMENT_POSTING (in tbl_name varchar(25))
how to use dynamic table name there...

I tried using cursor as
---------------------
BEGIN
------- CES_INT_PAYMENT_POSTING procedure is created for searching customer name from payment posting.

DECLARE Lv_Org_Str Varchar(5000);
DECLARE LV_CNAME_4CHAR,LV_CNAME_3CHAR,LV_CNAME_2CHAR,LV_CN AME_1CHAR,LV_CNAME_0CHAR, LV_CNAME VARCHAR(5000);
DECLARE lv_cnt_cname INTEGER;
DECLARE Lv_ORIG,Lv_ORG,Lv_DES varchar(10);
declare lv_var_ORIG,lv_var_ORG varchar(2000);
declare lv_remark varchar(50);
declare Lv_Org_Str_inv varchar(3000);
declare LV_Inv_No varchar(2000);
declare lv_inv_cnt integer;
declare lv_inv_pos integer;
--DECLARE V_TabSchema varchar(20);
DECLARE v_s1,v_s2 VARCHAR(1000);
DECLARE v_entity,v_baicode,v_code,v_str varchar(100);
DECLARE v_text varchar(2500);
DECLARE v_sr_no integer;
DECLARE v_st1 statement;
DECLARE v_c1 CURSOR for v_st1;
DECLARE v_c2 CURSOR for SELECT COCODE,INV_STR FROM INV_CODE;
-- var
set v_s1 = 'SELECT SR_NO,ENTITY,BAI_CODE_DESCRIPTION,TEXT from CESTEMP.'||TABLE_NAME;
PREPARE v_st1 FROM v_s1;

set Lv_ORIG = 'ORIG:';
set Lv_ORG = 'ORG=';
set Lv_DES = 'DES:';

OPEN v_c1;
FETCH from v_c1 INTO v_sr_no,v_entity,v_baicode,v_text;
OPEN v_c2;
FETCH FROM v_c2 INTO v_code,v_str;
if v_entity = v_code then -- cocode matching
set lv_inv_pos = instr(v_entity, v_str);
if lv_inv_pos != 0 then
set Lv_Org_Str_inv = substr(v_text, lv_inv_pos);
set LV_Inv_No = trim(SUBSTR(Lv_Org_Str_inv, 1, instr(Lv_Org_Str_inv, ' ')));
if lv_inv_no in( null,' ') then
set lv_inv_no=Lv_Org_Str_inv;
end if;
--insert into cestemp.cursor_test values(i.text, j.inv_str,Lv_Org_Str,LV_Inv_No);
select count(1)
into lv_inv_cnt
from SAP_INVOICE_MASTER
where INVOICE_NO = lv_inv_no;
if lv_inv_cnt >= 1 then

EXECUTE IMMEDIATE 'update '||TABLE_NAME||'set invoice_no = '||lv_inv_no||' where sr_no = '||v_sr_no;

end if;
end if;
end if;
CLOSE v_c2;
CLOSE v_c1;
---------------
but this will update only 1st row. i need to update total table....
Please suggest...
---------------------

CREATE OR REPLACE PROCEDURE CES_INT_PAYMENT_POSTING ()

BEGIN

DECLARE Lv_ORIG,Lv_ORG,Lv_DES varchar(10);
declare Lv_Org_Str_inv varchar(3000);
declare LV_Inv_No varchar(2000);
declare lv_inv_cnt integer;
declare lv_inv_pos integer;

for i as select * from payment_posting_temp do
for j as select * from inv_code do

if i.entity = j.cocode then
set lv_inv_pos = instr(i.text, j.inv_str);
if lv_inv_pos != 0 then
set Lv_Org_Str_inv = substr(i.text, lv_inv_pos);
set LV_Inv_No = trim(SUBSTR(Lv_Org_Str_inv, 1, instr(Lv_Org_Str_inv, ' ')));
if lv_inv_no in( null,' ') then
set lv_inv_no=Lv_Org_Str_inv;
end if;

select count(1)
into lv_inv_cnt
from pa_feed
where ASSIGNMENT = lv_inv_no;
if lv_inv_cnt >= 1 then

update payment_posting_temp
set invoice_no = lv_inv_no
where sr_no = i.sr_no;

end if;
end if;
end if;
end for;
end for;
commit;
end;