Hi experts,
I have the following code and its output ....This seems, update statement is not working inside SQL immediate.
The story is, I have list of tables and associated field name, I need to update the field value with the new value. Hence Table name, Field name, current value of the field and new vale for the same field are varying. I just want to run in loop the following code.
Although I have used concatenation for table name and field name whereas substitution for values, it seems it is not working, as well as also not producing any errors as such, may be a silly mistake...
Can anybody help me out please?
<CODE>
DECLARE
mtab varchar2(100);
mfld varchar2(100);
stmt varchar2(512);
BEGIN
mtab := 'SAPSR3."RFCATTRIB"';
mfld := '"RFCDEST"';
stmt := 'update '||mtab||' set '||mfld||' = :1'||' where '||mfld||' = :2';
dbms_output.put_line(stmt);
execute immediate stmt using 'AB1CLNT800','AB2CLNT800';
dbms_output.put_line(nvl(sql%rowcount,0));
EXCEPTION
When Others then
dbms_output.put_line('Error Level 0: '||to_char(SQLCODE)||'-'||SQLERRM);
END;
/
<END CODE>
<OUTPUT>
update SAPSR3."RFCATTRIB" set "RFCDEST" = :1 where "RFCDEST" = :2
0
PL/SQL procedure successfully completed.
<END OUTPUT>